Blame SOURCES/0004-proxy-Hold-reference-to-cancellable-object.patch

4dfa2a
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2bd53e
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
2bd53e
Date: Thu, 2 Feb 2017 15:11:42 -0200
4dfa2a
Subject: [PATCH] proxy: Hold reference to cancellable object
2bd53e
2bd53e
Being an asynchronous operation, there is no guarantee that the object
2bd53e
is valid by the time of the cleanup, so we hold a reference to it to
2bd53e
ensure it.
2bd53e
2bd53e
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2bd53e
---
2bd53e
 govirt/ovirt-proxy.c | 3 ++-
2bd53e
 1 file changed, 2 insertions(+), 1 deletion(-)
2bd53e
2bd53e
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
4dfa2a
index efe3284..2b690b6 100644
2bd53e
--- a/govirt/ovirt-proxy.c
2bd53e
+++ b/govirt/ovirt-proxy.c
4dfa2a
@@ -220,6 +220,7 @@ static void ovirt_proxy_call_async_data_free(OvirtProxyCallAsyncData *data)
2bd53e
         if ((data->cancellable != NULL) && (data->cancellable_cb_id != 0)) {
2bd53e
             g_cancellable_disconnect(data->cancellable, data->cancellable_cb_id);
2bd53e
         }
2bd53e
+        g_clear_object(&data->cancellable);
2bd53e
         g_slice_free(OvirtProxyCallAsyncData, data);
2bd53e
 }
2bd53e
 
4dfa2a
@@ -284,7 +285,7 @@ void ovirt_rest_call_async(OvirtRestCall *call,
2bd53e
     data->call_user_data = user_data;
2bd53e
     data->destroy_call_data = destroy_func;
2bd53e
     if (cancellable != NULL) {
2bd53e
-        data->cancellable = cancellable;
2bd53e
+        data->cancellable = g_object_ref(cancellable);
2bd53e
         data->cancellable_cb_id = g_cancellable_connect(cancellable,
2bd53e
                                                         G_CALLBACK (call_async_cancelled_cb),
2bd53e
                                                         call, NULL);