summaryrefslogtreecommitdiff
path: root/tp-account-widgets
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-07-27 23:30:24 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2015-07-28 22:34:58 +0200
commit6a4a30ff016b31cf366daa1e1854e20da45bf9fa (patch)
tree3c395d14223b10589dbf6aae3a826d6179d0e81e /tp-account-widgets
parent103ed6232b7d1c9094d3160ec3eeaf0af0d588c4 (diff)
downloadtelepathy-account-widgets-6a4a30ff016b31cf366daa1e1854e20da45bf9fa.tar.gz
Fix GetProtocolsData leak
A GetProtocolsData instance gets associated with a GSimpleAsyncResult in tpaw_protocol_get_all_async() using g_simple_async_result_set_op_res_gpointer(). A GDestroyNotify is set so that the GetProtocolsData instance is freed when the GSimpleAsyncResult is freed. However, this is not working as expected as the GetProtocolsData instance is keeping a reference on the GSimpleAsyncResult it's associated with, which creates a circular reference and causes the GetProtocolsData instance to never be freed. This commit drops the reference on the GSimpleAsyncResult instance owned by the GetProtocolsData instance as soon as it's no longer needed so that the GSimpleAsyncResult can be disposed, which triggers the destruction of the GetProtocolsData too. https://bugzilla.gnome.org/show_bug.cgi?id=752938
Diffstat (limited to 'tp-account-widgets')
-rw-r--r--tp-account-widgets/tpaw-protocol.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tp-account-widgets/tpaw-protocol.c b/tp-account-widgets/tpaw-protocol.c
index af8bb29b..51d7a462 100644
--- a/tp-account-widgets/tpaw-protocol.c
+++ b/tp-account-widgets/tpaw-protocol.c
@@ -484,8 +484,7 @@ cms_prepare_cb (GObject *source,
if (!tpaw_connection_managers_prepare_finish (cms, result, &error))
{
g_simple_async_result_take_error (data->result, error);
- g_simple_async_result_complete_in_idle (data->result);
- return;
+ goto out;
}
for (l = tpaw_connection_managers_get_cms (cms); l != NULL; l = l->next)
@@ -494,13 +493,14 @@ cms_prepare_cb (GObject *source,
data->protocols = g_list_sort (data->protocols,
(GCompareFunc) protocol_sort_func);
+out:
g_simple_async_result_complete_in_idle (data->result);
+ g_object_unref (data->result);
}
static void
destroy_get_protocols_data (GetProtocolsData *data)
{
- g_object_unref (data->result);
g_hash_table_unref (data->seen_protocols);
g_list_free_full (data->protocols, g_object_unref);
g_slice_free (GetProtocolsData, data);