diff options
author | Andrea Azzarone <andrea.azzarone@canonical.com> | 2018-09-25 17:12:18 +0200 |
---|---|---|
committer | Andrea Azzarone <andrea.azzarone@canonical.com> | 2018-09-25 17:12:18 +0200 |
commit | d7857c113a81554271445b2368742cc3e767aa02 (patch) | |
tree | a02d7c6e9613a0db20fa373fc7f180dbf6104545 /shell/cc-object-storage.c | |
parent | 75556d7c5af3cdff5e527409cce05e9903181fe7 (diff) | |
download | gnome-control-center-d7857c113a81554271445b2368742cc3e767aa02.tar.gz |
object-storage: Check for cancellation before resulting in assert failure
As per doumentation: "It is a programming error to create an identical proxy
while asynchronously creating one. Not cancelling this operation will result in
an assertion failure when calling cc_object_storage_create_dbus_proxy_finish()."
In order to fullfill the second part we need to check for errors (including
cancellation ones) before we generate an assertion failure.
Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/158
Diffstat (limited to 'shell/cc-object-storage.c')
-rw-r--r-- | shell/cc-object-storage.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/shell/cc-object-storage.c b/shell/cc-object-storage.c index 46038cc34..3e3ab4d9a 100644 --- a/shell/cc-object-storage.c +++ b/shell/cc-object-storage.c @@ -363,6 +363,16 @@ cc_object_storage_create_dbus_proxy_finish (GAsyncResult *result, task_data = g_task_get_task_data (task); + /* Retrieve the newly created proxy */ + proxy = g_task_propagate_pointer (task, &local_error); + + /* If the proxy is not cached, do the normal caching routine */ + if (local_error) + { + g_propagate_error (error, g_steal_pointer (&local_error)); + return NULL; + } + key = g_strdup_printf ("CcObjectStorage::dbus-proxy(%s,%s,%s)", task_data->name, task_data->path, @@ -379,16 +389,6 @@ cc_object_storage_create_dbus_proxy_finish (GAsyncResult *result, g_assert (task_data != NULL); g_assert (task_data->cached == cc_object_storage_has_object (key)); - /* Retrieve the newly created proxy */ - proxy = g_task_propagate_pointer (task, &local_error); - - /* If the proxy is not cached, do the normal caching routine */ - if (local_error) - { - g_propagate_error (error, g_steal_pointer (&local_error)); - return NULL; - } - /* If the proxy is already cached, destroy the newly created and used the cached proxy * instead. */ |