diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-08-22 21:37:21 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-09-09 16:40:53 +0200 |
commit | f4a0ab757fca8c9ea7900f6259e8ca51a4b0a571 (patch) | |
tree | 806ed81c864d558a8341a7dcb6619b47f948ff3a /libnm | |
parent | eb7e2e4cd684dbd1fcb9339553a19451fa9432ab (diff) | |
download | NetworkManager-f4a0ab757fca8c9ea7900f6259e8ca51a4b0a571.tar.gz |
libnm: make waiting objects fail when an object initialization fails
Previously, when the load of an object failed and there were other
objects waiting for it, those objects would remain waiting
forever. Make them fail as well.
Diffstat (limited to 'libnm')
-rw-r--r-- | libnm/nm-object.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libnm/nm-object.c b/libnm/nm-object.c index 3b41041e24..337ca69862 100644 --- a/libnm/nm-object.c +++ b/libnm/nm-object.c @@ -488,14 +488,29 @@ create_async_complete (GObject *object, NMObjectTypeAsyncData *async_data) static void create_async_inited (GObject *object, GAsyncResult *result, gpointer user_data) { + NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); + NMObjectPrivate *odata_priv; NMObjectTypeAsyncData *async_data = user_data; GError *error = NULL; + ObjectCreatedData *odata; - NM_OBJECT_GET_PRIVATE (object)->inited = TRUE; + priv->inited = TRUE; if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, &error)) { dbgmsg ("Could not create object for %s: %s", nm_object_get_path (NM_OBJECT (object)), error->message); + + while (priv->waiters) { + odata = priv->waiters->data; + odata_priv = NM_OBJECT_GET_PRIVATE (odata->self); + + priv->waiters = g_slist_remove (priv->waiters, odata); + if (!odata_priv->reload_error) + odata_priv->reload_error = g_error_copy (error); + odata_priv->reload_remaining--; + reload_complete (odata->self, FALSE); + } + g_error_free (error); g_clear_object (&object); } @@ -503,15 +518,13 @@ create_async_inited (GObject *object, GAsyncResult *result, gpointer user_data) create_async_complete (object, async_data); if (object) { - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - /* There are some object properties whose creation couldn't proceed * because it depended on this object. */ while (priv->waiters) { - ObjectCreatedData *odata = priv->waiters->data; - + odata = priv->waiters->data; priv->waiters = g_slist_remove (priv->waiters, odata); object_property_maybe_complete (odata); + } } } |