From a52d620549acb419056342fc978914cffaf8bedb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 30 Mar 2023 08:16:25 +0200 Subject: [PATCH] core: assert that nm_utils_spawn_helper() is used with default context --- src/core/nm-core-utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index 7e428a7f4f..1af875d796 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -5138,6 +5138,12 @@ nm_utils_spawn_helper(const char *const *args, context = g_task_get_context(info->task); + /* The async function makes a lukewarm attempt to honor the current thread default + * context. However, it later uses nm_utils_kill_child_async() which always uses + * g_main_context_default(). For now, the function really can only be used with the + * main context. */ + nm_assert(context == g_main_context_default()); + info->child_watch_source = g_child_watch_source_new(info->pid); g_source_set_callback(info->child_watch_source, G_SOURCE_FUNC(helper_child_terminated),