summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-03-11 11:45:32 +0100
committerThomas Haller <thaller@redhat.com>2022-03-13 23:15:17 +0100
commite7753357cec1b27f733118f4edb625299fa340cd (patch)
tree18c791c42d8be24ea30d00ca0e442fb5df284e85
parentbd97feadc875de486429729ed0a3b1572b13e8d2 (diff)
downloadNetworkManager-e7753357cec1b27f733118f4edb625299fa340cd.tar.gz
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') (cherry picked from commit ae0cc9618c49bb74bbe54a073dc337e9a3b0005b)
-rw-r--r--src/libnm-client-impl/nm-client.c4
1 files 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