mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-gtk
synced 2026-02-01 17:49:50 +00:00
wocky: Simplify wocky_http_proxy_connect_finish()
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. The leak is: ==20010== 4,348 (56 direct, 4,292 indirect) bytes in 1 blocks are definitely lost in loss record 20,762 of 20,999 ==20010== at 0x4C2DA60: calloc (vg_replace_malloc.c:711) ==20010== by 0xD0F6EB0: g_malloc0 (gmem.c:124) ==20010== by 0x75C0978: wocky_http_proxy_connect_async (wocky-http-proxy.c:359) ==20010== by 0xCB4E22C: g_socket_client_connected_callback (gsocketclient.c:1548) ==20010== by 0xCB57342: g_task_return_now (gtask.c:1107) ==20010== by 0xCB579E5: g_task_return (gtask.c:1165) ==20010== by 0xCB4FB1C: g_socket_connection_connect_callback (gsocketconnection.c:236) ==20010== by 0xCB47160: socket_source_dispatch (gsocket.c:3543) ==20010== by 0xD0F1702: g_main_dispatch (gmain.c:3154) ==20010== by 0xD0F1702: g_main_context_dispatch (gmain.c:3769) ==20010== by 0xD0F1AAF: g_main_context_iterate.isra.29 (gmain.c:3840) ==20010== by 0xD0F1B5B: g_main_context_iteration (gmain.c:3901) ==20010== by 0xCB7D58C: g_application_run (gapplication.c:2381) ==20010== by 0x41571C: main (remote-viewer-main.c:42)
This commit is contained in:
parent
e174902167
commit
57ba17589b
@ -454,8 +454,10 @@ 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;
|
||||
g_object_unref (data->task);
|
||||
free_connect_data (data);
|
||||
}
|
||||
|
||||
static GIOStream *
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user