[grilo] net: avoid request_async() crash on cancellable unref
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] net: avoid request_async() crash on cancellable unref
- Date: Mon, 17 Nov 2014 11:12:53 +0000 (UTC)
commit e823b8fe63846a9c60ebd59a8bf07e9c602a8528
Author: Marc-André Lureau <marcandre lureau gmail com>
Date: Sat Nov 15 19:35:10 2014 +0100
net: avoid request_async() crash on cancellable unref
The caller may unref the cancellable, keep a reference on cancellable to
avoid potential crash.
https://bugzilla.gnome.org/show_bug.cgi?id=740186
libs/net/grl-net-wc.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/libs/net/grl-net-wc.c b/libs/net/grl-net-wc.c
index ba3f713..b020f17 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -443,6 +443,7 @@ request_clos_destroy (gpointer data)
struct request_clos *c = (struct request_clos *) data;
g_free (c->url);
+ g_clear_object (&c->cancellable);
g_clear_pointer (&c->headers, g_hash_table_unref);
g_free (c);
}
@@ -772,7 +773,7 @@ get_url (GrlNetWc *self,
c->url = g_strdup (url);
c->headers = headers? g_hash_table_ref (headers): NULL;
c->result = result;
- c->cancellable = cancellable;
+ c->cancellable = g_object_ref (cancellable);
g_get_current_time (&now);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]