extern "C" {
static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
{
- gdk_threads_enter();
-
- wxMutexGuiLeave();
g_mainThreadLocked = true;
gint res = (*wxgs_poll_func)(ufds, nfds, timeout);
- wxMutexGuiEnter();
g_mainThreadLocked = false;
- gdk_threads_leave();
-
return res;
}
}
#if wxUSE_THREADS
if (!g_thread_supported())
+ {
g_thread_init(NULL);
+ gdk_threads_init();
+ }
wxgs_poll_func = g_main_context_get_poll_func(NULL);
g_main_context_set_poll_func(NULL, wxapp_poll_func);
{
if (m_idleSourceId != 0)
g_source_remove(m_idleSourceId);
-#if wxUSE_THREADS
- delete m_idleMutex;
- m_idleMutex = NULL;
-#endif
+
// release reference acquired by Initialize()
g_type_class_unref(g_type_class_peek(GTK_TYPE_WIDGET));
gdk_threads_leave();
wxAppBase::CleanUp();
+
+ // delete this mutex as late as possible as it's used from WakeUpIdle(), in
+ // particular do it after calling the base class CleanUp() which can result
+ // in it being called
+#if wxUSE_THREADS
+ delete m_idleMutex;
+ m_idleMutex = NULL;
+#endif
}
void wxApp::WakeUpIdle()
}
#endif // __WXDEBUG__
+
+#if wxUSE_THREADS
+void wxGUIAppTraits::MutexGuiEnter()
+{
+ gdk_threads_enter();
+}
+
+void wxGUIAppTraits::MutexGuiLeave()
+{
+ gdk_threads_leave();
+}
+#endif // wxUSE_THREADS