From a744397ad56c93dfaf80fd576e70e1a8dedbdf98 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 8 Dec 2020 15:41:46 +0100 Subject: [PATCH] libnm: fix re-entrancy of NMClient.dispose() for _init_release_all() GObject's dispose() functions may be called multiple times to break reference cycles. As dispose() calls _init_release_all(), the object might already be partially destroyed. Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient') (cherry picked from commit ef6edd8dbd871e267ff570395c50bb17fc509bcc) (cherry picked from commit 9659db281f0e322d91e1ef4938f7ea1fa028c8b8) --- libnm/nm-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnm/nm-client.c b/libnm/nm-client.c index d7f61152dc..7245f17a5a 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -6976,7 +6976,7 @@ _init_release_all (NMClient *self) nm_assert (c_list_is_empty (&priv->dbus_objects_lst_head_on_dbus)); nm_assert (c_list_is_empty (&priv->dbus_objects_lst_head_with_nmobj_not_ready)); nm_assert (c_list_is_empty (&priv->dbus_objects_lst_head_with_nmobj_ready)); - nm_assert (g_hash_table_size (priv->dbus_objects) == 0); + nm_assert (nm_g_hash_table_size (priv->dbus_objects) == 0); } /*****************************************************************************/ @@ -7833,7 +7833,7 @@ dispose (GObject *object) nm_assert (c_list_is_empty (&priv->queue_notify_lst_head)); nm_assert (c_list_is_empty (&priv->notify_event_lst_head)); nm_assert (c_list_is_empty (&self->obj_base.queue_notify_lst)); - nm_assert (!priv->dbus_objects || g_hash_table_size (priv->dbus_objects) == 0); + nm_assert (nm_g_hash_table_size (priv->dbus_objects) == 0); nml_dbus_property_o_clear_many (priv->nm.property_o, G_N_ELEMENTS (priv->nm.property_o), NULL); nml_dbus_property_ao_clear_many (priv->nm.property_ao, G_N_ELEMENTS (priv->nm.property_ao), NULL);