From ae0cc9618c49bb74bbe54a073dc337e9a3b0005b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 11 Mar 2022 11:45:32 +0100 Subject: [PATCH] libnm: fix assertion in NMClient checking for current main context NMClient is strongly tied to the GMainContext with which it was created. Several operations must only be called from within the context. There was an assertion for that. However, creating (and init_async()) should be allowed to call not from within the GMainContext. So if the current context has no owner (is not acquired), then it's also OK. Fix the assertion for that. Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient') --- src/libnm-client-impl/nm-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libnm-client-impl/nm-client.c b/src/libnm-client-impl/nm-client.c index 05942764e5..cd2aa73055 100644 --- a/src/libnm-client-impl/nm-client.c +++ b/src/libnm-client-impl/nm-client.c @@ -764,7 +764,7 @@ _nm_client_set_property_sync_legacy(NMClient *self, NMClientPrivate *_priv = NM_CLIENT_GET_PRIVATE(self); \ \ nm_assert(g_source_get_context(_source) == _priv->x_context); \ - nm_assert(g_main_context_is_owner(_priv->x_context)); \ + nm_assert(nm_g_main_context_can_acquire(_priv->x_context)); \ } \ } \ } \ @@ -778,7 +778,7 @@ _nm_client_set_property_sync_legacy(NMClient *self, \ nm_assert((g_main_context_get_thread_default() ?: g_main_context_default()) \ == _priv->x_context); \ - nm_assert(g_main_context_is_owner(_priv->x_context)); \ + nm_assert(nm_g_main_context_can_acquire(_priv->x_context)); \ } \ } \ G_STMT_END