Blame SOURCES/0005-proxy-Check-if-operation-is-cancelled-before-disconn.patch

1bd27f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
102000
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
102000
Date: Thu, 2 Feb 2017 15:13:48 -0200
1bd27f
Subject: [PATCH] proxy: Check if operation is cancelled before disconnecting
1bd27f
 signal
102000
102000
According to the documentation, g_cancellable_disconnect() waits for the
102000
signal handler to finish, and if it is called from the handler itself, it
102000
will result in a deadlock. To avoid it, we check if the operation is
102000
cancelled and if so, call g_signal_handler_disconnect() instead of
102000
g_cancellable_disconnect().
102000
102000
https://developer.gnome.org/gio/stable/GCancellable.html#g-cancellable-disconnect
102000
102000
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
102000
---
102000
 govirt/ovirt-proxy.c | 10 +++++++++-
102000
 1 file changed, 9 insertions(+), 1 deletion(-)
102000
102000
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
1bd27f
index 2b690b6..921e22e 100644
102000
--- a/govirt/ovirt-proxy.c
102000
+++ b/govirt/ovirt-proxy.c
102000
@@ -218,7 +218,15 @@ static void ovirt_proxy_call_async_data_free(OvirtProxyCallAsyncData *data)
102000
             g_object_unref(G_OBJECT(data->result));
102000
         }
102000
         if ((data->cancellable != NULL) && (data->cancellable_cb_id != 0)) {
102000
-            g_cancellable_disconnect(data->cancellable, data->cancellable_cb_id);
102000
+            if (g_cancellable_is_cancelled(data->cancellable)) {
102000
+                /* Cancellable has already been cancelled, we don't need to use
102000
+                 * g_cancellable_disconnect() to disconnect the signal handler
102000
+                 * as we know the 'cancelled' signal is no longer going to be emitted
102000
+                 */
102000
+                g_signal_handler_disconnect(data->cancellable, data->cancellable_cb_id);
102000
+            } else {
102000
+                g_cancellable_disconnect(data->cancellable, data->cancellable_cb_id);
102000
+            }
102000
         }
102000
         g_clear_object(&data->cancellable);
102000
         g_slice_free(OvirtProxyCallAsyncData, data);