From: Kevin Hock Date: Mon, 25 Oct 2004 03:24:42 +0000 (+0000) Subject: MutexGui calls in WakeUpIdle are not needed under GTK2, fixing the long-standing... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/19722331f8f7fb41a778ddf8ed2c66a4ace8b501 MutexGui calls in WakeUpIdle are not needed under GTK2, fixing the long-standing "random" lockups experienced when using wxPostEvent from a thread. Collaboration with RR. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 17b4f900b7..86822b5abd 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -164,20 +164,31 @@ bool wxApp::Yield(bool onlyIfNeeded) // wxWakeUpIdle //----------------------------------------------------------------------------- +// RR/KH: The wxMutexGui calls are not needed on GTK2 according to +// the GTK faq, http://www.gtk.org/faq/#AEN500 +// The calls to gdk_threads_enter() and leave() are specifically noted +// as not being necessary. The MutexGui calls are still left in for GTK1. +// Eliminating the MutexGui calls fixes the long-standing "random" lockup +// when using wxPostEvent (which calls WakeUpIdle) from a thread. + void wxApp::WakeUpIdle() { +#ifndef __WXGTK20__ #if wxUSE_THREADS if (!wxThread::IsMain()) wxMutexGuiEnter(); -#endif +#endif // wxUSE_THREADS_ +#endif // __WXGTK2__ if (g_isIdle) wxapp_install_idle_handler(); +#ifndef __WXGTK20__ #if wxUSE_THREADS if (!wxThread::IsMain()) wxMutexGuiLeave(); -#endif +#endif // wxUSE_THREADS_ +#endif // __WXGTK2__ } //----------------------------------------------------------------------------- diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 17b4f900b7..86822b5abd 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -164,20 +164,31 @@ bool wxApp::Yield(bool onlyIfNeeded) // wxWakeUpIdle //----------------------------------------------------------------------------- +// RR/KH: The wxMutexGui calls are not needed on GTK2 according to +// the GTK faq, http://www.gtk.org/faq/#AEN500 +// The calls to gdk_threads_enter() and leave() are specifically noted +// as not being necessary. The MutexGui calls are still left in for GTK1. +// Eliminating the MutexGui calls fixes the long-standing "random" lockup +// when using wxPostEvent (which calls WakeUpIdle) from a thread. + void wxApp::WakeUpIdle() { +#ifndef __WXGTK20__ #if wxUSE_THREADS if (!wxThread::IsMain()) wxMutexGuiEnter(); -#endif +#endif // wxUSE_THREADS_ +#endif // __WXGTK2__ if (g_isIdle) wxapp_install_idle_handler(); +#ifndef __WXGTK20__ #if wxUSE_THREADS if (!wxThread::IsMain()) wxMutexGuiLeave(); -#endif +#endif // wxUSE_THREADS_ +#endif // __WXGTK2__ } //-----------------------------------------------------------------------------