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

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