X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1ae2e0af5aaefe5a9409964daed3c5ca70ee24a0..be6577566570876c0c00621ff98c786d7c6de80e:/src/gtk/app.cpp diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 3cb777b959..1bf855421b 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -168,6 +168,8 @@ bool wxApp::Yield(bool onlyIfNeeded) // wxWakeUpIdle //----------------------------------------------------------------------------- +static bool gs_WakeUpIdle = false; + void wxWakeUpIdle() { #if wxUSE_THREADS @@ -175,8 +177,11 @@ void wxWakeUpIdle() wxMutexGuiEnter(); #endif - if (g_isIdle) + if (g_isIdle) { + gs_WakeUpIdle = true; wxapp_install_idle_handler(); + gs_WakeUpIdle = false; + } #if wxUSE_THREADS if (!wxThread::IsMain()) @@ -361,6 +366,11 @@ static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout ) void wxapp_install_idle_handler() { + // GD: this assert is raised when using the thread sample (which works) + // so the test is probably not so easy. Can widget callbacks be + // triggered from child threads and, if so, for which widgets? + // wxASSERT_MSG( wxThread::IsMain() || gs_WakeUpIdle, wxT("attempt to install idle handler from widget callback in child thread (should be exclusively from wxWakeUpIdle)") ); + wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") ); g_isIdle = FALSE; @@ -793,10 +803,11 @@ int wxEntryStart( int& argc, char *argv[] ) if (!wxOKlibc()) wxConvCurrent = (wxMBConv*) NULL; #endif - gdk_threads_enter(); - gtk_init( &argc, &argv ); + /* we can not enter threads before gtk_init is done */ + gdk_threads_enter(); + wxSetDetectableAutoRepeat( TRUE ); if (!wxApp::Initialize())