From 0d5d1745ce338835064419a44901cbb71995b776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 21 Dec 2022 18:00:37 +0100 Subject: [PATCH] thread: Push the thread-default main context Makes g_main_context_get_thread_default() do the right thing. Part-of: --- src/backends/native/meta-thread.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backends/native/meta-thread.c b/src/backends/native/meta-thread.c index 80b6beeef..6f08b96e4 100644 --- a/src/backends/native/meta-thread.c +++ b/src/backends/native/meta-thread.c @@ -297,14 +297,16 @@ thread_impl_func (gpointer user_data) MetaContext *context = meta_backend_get_context (priv->backend); MetaThreadImpl *impl = priv->impl; MetaThreadImplRunFlags run_flags = META_THREAD_IMPL_RUN_FLAG_NONE; -#ifdef HAVE_PROFILER GMainContext *thread_context = meta_thread_impl_get_main_context (impl); +#ifdef HAVE_PROFILER MetaProfiler *profiler = meta_context_get_profiler (context); #endif g_mutex_lock (&priv->kernel.init_mutex); g_mutex_unlock (&priv->kernel.init_mutex); + g_main_context_push_thread_default (thread_context); + #ifdef HAVE_PROFILER meta_profiler_register_thread (profiler, thread_context, priv->name); #endif @@ -331,6 +333,8 @@ thread_impl_func (gpointer user_data) meta_profiler_unregister_thread (profiler, thread_context); #endif + g_main_context_pop_thread_default (thread_context); + return GINT_TO_POINTER (TRUE); }