[spice-gtk 1/3] wocky: Simplify wocky_http_proxy_connect_finish()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rather than returning the whole ConnectAsyncData struct with
g_task_return_pointer(), we can return only the GIOStream object as this
is what we are interested in.
This has the side-effect of fixing a ConnectAsyncData leak as after
calling g_task_propagate_pointer() the old code had ownership of the
ConnectAsyncData instance but was never freeing it.
---
 src/wocky-http-proxy.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/wocky-http-proxy.c b/src/wocky-http-proxy.c
index f62f1fb..d1519b8 100644
--- a/src/wocky-http-proxy.c
+++ b/src/wocky-http-proxy.c
@@ -454,7 +454,9 @@ reply_read_cb (GObject *source,
       return;
     }
 
-  g_task_return_pointer (data->task, data, (GDestroyNotify) free_connect_data);
+  g_task_return_pointer (data->task, data->io_stream, (GDestroyNotify) g_object_unref);
+  data->io_stream = NULL;
+  free_connect_data (data);
   g_object_unref (data->task);
 }
 
@@ -464,9 +466,8 @@ wocky_http_proxy_connect_finish (GProxy *proxy,
     GError **error)
 {
   GTask *task = G_TASK (result);
-  ConnectAsyncData *data = g_task_propagate_pointer (task, error);
 
-  return data ? g_object_ref (data->io_stream) : NULL;
+  return g_task_propagate_pointer (task, error);
 }
 
 static gboolean
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]