Commit b54bb72c authored by Andrea Azzarone's avatar Andrea Azzarone 🚴 Committed by Georges Basile Stavracas Neto

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: #158
parent e037fdf1
......@@ -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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment