diff options
author | Thomas Haller <thaller@redhat.com> | 2022-03-11 11:45:32 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-03-11 12:11:44 +0100 |
commit | ae0cc9618c49bb74bbe54a073dc337e9a3b0005b (patch) | |
tree | 71a6c7d4a56dcfd864e4940dfb31fc049ddd059c | |
parent | 5dc9307a34271c50d6850e02c48d623879ae4d72 (diff) | |
download | NetworkManager-ae0cc9618c49bb74bbe54a073dc337e9a3b0005b.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')
-rw-r--r-- | src/libnm-client-impl/nm-client.c | 4 |
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 |