+#if wxUSE_GUI
+ // we need a flag to prevent infinite recursion which happens, for
+ // example, when GetAltForEncoding() is called from an OnPaint() handler:
+ // in this case, wxYield() which is called from wxMessageBox() we use here
+ // will lead to another call of OnPaint() and hence to another call of
+ // GetAltForEncoding() - and it is impossible to catch this from the user
+ // code because we are called from wxFont ctor implicitly.
+
+ // assume we're always called from the main thread, so that it is safe to
+ // use a static var
+ static bool s_inGetAltForEncoding = FALSE;
+
+ if ( interactive && s_inGetAltForEncoding )
+ return FALSE;
+
+ ReentrancyBlocker blocker(s_inGetAltForEncoding);
+#endif // wxUSE_GUI
+