summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-10-21 14:30:43 -0500
committerJonathon Jongsma <jjongsma@redhat.com>2015-10-22 09:42:17 -0500
commit0c7643cb7f5c5411daff5f6e5d8a823b48ac874a (patch)
treebd860c67043d3c09e109a2daebe1a3aa046dca1d
parent17a6b8a78a3f48f669cf1ccda32a92cc8faef513 (diff)
MainChannel: move task free from finalize to dispose
In order to avoid reference cycles, you're supposed to release references in dispose, especially to those objects that can hold references to yourself. This probably wasn't causing any leaks, since the file transfer tasks generally are not alive when the main channel is destroyed, but it's more proper.
-rw-r--r--src/channel-main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/channel-main.c b/src/channel-main.c
index 3a8c1dd..a833078 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -405,6 +405,8 @@ static void spice_main_channel_dispose(GObject *obj)
c->migrate_delayed_id = 0;
}
+ g_clear_pointer(&c->file_xfer_tasks, g_hash_table_unref);
+
g_cancellable_cancel(c->cancellable_volume_info);
g_clear_object(&c->cancellable_volume_info);
@@ -418,8 +420,6 @@ static void spice_main_channel_finalize(GObject *obj)
g_free(c->agent_msg_data);
agent_free_msg_queue(SPICE_MAIN_CHANNEL(obj));
- if (c->file_xfer_tasks)
- g_hash_table_unref(c->file_xfer_tasks);
if (G_OBJECT_CLASS(spice_main_channel_parent_class)->finalize)
G_OBJECT_CLASS(spice_main_channel_parent_class)->finalize(obj);