X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96997d6511c6bd055e5465e147a6b568ae445702..1a8caf94abb82772c1baf37c8fb820def3c06798:/src/gtk1/app.cpp diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 77f619a9aa..5db09e1359 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -82,25 +82,27 @@ void wxExit() bool wxYield() { - bool has_idle = (wxTheApp->m_idleTag != 0); +#ifdef __WXDEBUG__ + static bool s_inYield = FALSE; + + if (s_inYield) + wxFAIL_MSG( wxT("wxYield called recursively" ) ); + + s_inYield = TRUE; +#endif - if (has_idle) + if (!g_isIdle) { - /* We need to temporarily remove idle callbacks or the loop will - never finish. */ + // We need to remove idle callbacks or the loop will + // never finish. gtk_idle_remove( wxTheApp->m_idleTag ); wxTheApp->m_idleTag = 0; + g_isIdle = TRUE; } while (gtk_events_pending()) gtk_main_iteration(); - if (has_idle) - { - /* re-add idle handler (very low priority) */ - wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); - } - // disable log flushing from here because a call to wxYield() shouldn't // normally result in message boxes popping up &c wxLog::Suspend(); @@ -113,6 +115,10 @@ bool wxYield() // let the logs be flashed again wxLog::Resume(); +#ifdef __WXDEBUG__ + s_inYield = FALSE; +#endif + return TRUE; } @@ -154,6 +160,11 @@ gint wxapp_pending_callback( gpointer WXUNUSED(data) ) g_pendingTag = 0; + /* flush the logged messages if any */ +#if wxUSE_LOG + wxLog::FlushActive(); +#endif // wxUSE_LOG + // Release lock again gdk_threads_leave(); @@ -194,6 +205,8 @@ void wxapp_install_idle_handler() { wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") ); + g_isIdle = FALSE; + if (g_pendingTag == 0) g_pendingTag = gtk_idle_add_priority( 900, wxapp_pending_callback, (gpointer) NULL ); @@ -204,8 +217,6 @@ void wxapp_install_idle_handler() idle time). Very low priority. */ wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); - - g_isIdle = FALSE; } #if wxUSE_THREADS @@ -284,7 +295,8 @@ wxApp::wxApp() m_topWindow = (wxWindow *) NULL; m_exitOnFrameDelete = TRUE; - m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL ); + m_idleTag = 0; + wxapp_install_idle_handler(); #if wxUSE_THREADS m_wakeUpTimerTag = 0; @@ -424,11 +436,6 @@ void wxApp::OnIdle( wxIdleEvent &event ) event.RequestMore(TRUE); s_inOnIdle = FALSE; - - /* flush the logged messages if any */ -#if wxUSE_LOG - wxLog::FlushActive(); -#endif // wxUSE_LOG } bool wxApp::SendIdleEvents() @@ -609,15 +616,9 @@ int wxEntryStart( int argc, char *argv[] ) { #if wxUSE_THREADS /* GTK 1.2 up to version 1.2.3 has broken threads */ -#ifdef __VMS__ - if ((vms_gtk_major_version() == 1) && - (vms_gtk_minor_version() == 2) && - (vms_gtk_micro_version() < 4)) -#else if ((gtk_major_version == 1) && (gtk_minor_version == 2) && (gtk_micro_version < 4)) -#endif { printf( "wxWindows warning: GUI threading disabled due to outdated GTK version\n" ); }