From 661c9f93a90a8855c4dd8b6a215312387387ee9c Mon Sep 17 00:00:00 2001 From: Philip Van Hoof Date: Mon, 1 Nov 2010 16:59:44 +0100 Subject: Push and pop the thread-default context for the current thread Merge-request: 869 Reviewed-by: Thiago Macieira (cherry picked from commit aa88b7044dd86850e6986aa80104bb38bb7b12eb) --- src/corelib/kernel/qeventdispatcher_glib.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 8390275..6fa2707 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -311,6 +311,10 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) } } +#if GLIB_CHECK_VERSION (2, 22, 0) + g_main_context_push_thread_default (mainContext); +#endif + // setup post event source postEventSource = reinterpret_cast(g_source_new(&postEventSourceFuncs, sizeof(GPostEventSource))); @@ -389,6 +393,9 @@ QEventDispatcherGlib::~QEventDispatcherGlib() d->postEventSource = 0; Q_ASSERT(d->mainContext != 0); +#if GLIB_CHECK_VERSION (2, 22, 0) + g_main_context_pop_thread_default (d->mainContext); +#endif g_main_context_unref(d->mainContext); d->mainContext = 0; } -- cgit v0.12