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

Christophe Fergeau cfergeau at redhat.com
Thu Aug 4 13:18:16 UTC 2016


On Thu, Aug 04, 2016 at 03:13:38PM +0200, Victor Toso wrote:
> Hi,
> 
> On Wed, Aug 03, 2016 at 09:49:51AM +0200, Christophe Fergeau wrote:
> > 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);
> 
> You need to move the g_object_unref(data->task) to be before
> free_connect_data() (or put the next patch before this one?)

Ah definitely, thanks! Yeah, I artificially recreated this patch while
splitting the changes, this shows here :)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160804/2114f5cd/attachment.sig>


More information about the Spice-devel mailing list