[gnome-control-center] object-storage: Check for cancellation before resulting in assert failure
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] object-storage: Check for cancellation before resulting in assert failure
- Date: Tue, 25 Sep 2018 23:28:14 +0000 (UTC)
commit d7857c113a81554271445b2368742cc3e767aa02
Author: Andrea Azzarone <andrea azzarone canonical com>
Date: Tue Sep 25 17:12:18 2018 +0200
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
shell/cc-object-storage.c | 20 ++++++++++----------
1 file 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.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]