X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/20e05ffbd3eff02a4c643e412d4f600cdea26952..fb5700fe76a3baa7ed8d078ae5727855ca47275c:/src/gtk/app.cpp?ds=sidebyside

diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp
index 26a9ea36e6..e399efa119 100644
--- a/src/gtk/app.cpp
+++ b/src/gtk/app.cpp
@@ -226,12 +226,25 @@ void wxapp_install_idle_handler()
 {
     wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
 
-    /* this routine gets called by all event handlers
-       indicating that the idle is over. */
+    /* This routine gets called by all event handlers
+       indicating that the idle is over. It may also
+       get called from other thread for sending events
+       to the main thread (and processing these in
+       idle time). */
+
+#if wxUSE_THREADS
+    if (!wxThread::IsMain())
+        GDK_THREADS_ENTER ();
+#endif
 
     wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
 
     g_isIdle = FALSE;
+    
+#if wxUSE_THREADS
+    if (!wxThread::IsMain())
+        GDK_THREADS_LEAVE ();
+#endif
 }
 
 #if wxUSE_THREADS