[libgovirt] proxy: Hold reference to cancellable object
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] proxy: Hold reference to cancellable object
- Date: Mon, 6 Feb 2017 16:02:01 +0000 (UTC)
commit 25beefa304af1fa5ce529401ccb19aac252dd185
Author: Eduardo Lima (Etrunko) <etrunko redhat com>
Date: Thu Feb 2 15:11:42 2017 -0200
proxy: Hold reference to cancellable object
Being an asynchronous operation, there is no guarantee that the object
is valid by the time of the cleanup, so we hold a reference to it to
ensure it.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko redhat com>
govirt/ovirt-proxy.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index 10cc25f..70c08ac 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -218,6 +218,7 @@ static void ovirt_proxy_call_async_data_free(OvirtProxyCallAsyncData *data)
if ((data->cancellable != NULL) && (data->cancellable_cb_id != 0)) {
g_cancellable_disconnect(data->cancellable, data->cancellable_cb_id);
}
+ g_clear_object(&data->cancellable);
g_slice_free(OvirtProxyCallAsyncData, data);
}
@@ -282,7 +283,7 @@ void ovirt_rest_call_async(OvirtRestCall *call,
data->call_user_data = user_data;
data->destroy_call_data = destroy_func;
if (cancellable != NULL) {
- data->cancellable = cancellable;
+ data->cancellable = g_object_ref(cancellable);
data->cancellable_cb_id = g_cancellable_connect(cancellable,
G_CALLBACK (call_async_cancelled_cb),
call, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]