From c721477d11d4fe144111d6d2eec8f93f2e9186c9 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 9 Feb 2012 13:25:59 -0600 Subject: [PATCH] libnm-glib: fix premature child object signal emission The notifications for child objects (like NMClient's device-added signal or NMDeviceWifi's access-point-added signal) could get emitted before the child objects were actually constructed, because object_created() decrements the properties-retrieved tracking variable, which wasn't always incremented before calling that function. --- libnm-glib/nm-object.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index 62ed6745e5..f7c2894173 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -635,6 +635,9 @@ handle_object_property (NMObject *self, const char *property_name, GValue *value odata->array = FALSE; odata->property_name = property_name; + if (priv->reload_results) + priv->reload_remaining++; + path = g_value_get_boxed (value); if (!strcmp (path, "/")) { object_created (NULL, odata); @@ -651,8 +654,6 @@ handle_object_property (NMObject *self, const char *property_name, GValue *value return obj != NULL; } - if (priv->reload_results) - priv->reload_remaining++; _nm_object_create_async (pi->object_type, priv->connection, path, object_created, odata); /* Assume success */ @@ -689,6 +690,11 @@ handle_object_array_property (NMObject *self, const char *property_name, GValue continue; } + if (add_to_reload) { + priv->reload_remaining++; + add_to_reload = FALSE; + } + obj = G_OBJECT (_nm_object_cache_get (path)); if (obj) { object_created (obj, odata); @@ -699,10 +705,6 @@ handle_object_array_property (NMObject *self, const char *property_name, GValue continue; } - if (add_to_reload) { - priv->reload_remaining++; - add_to_reload = FALSE; - } _nm_object_create_async (pi->object_type, priv->connection, path, object_created, odata); }