[Spice-devel] [PATCH spice-gtk 11/15] channel-main: Make SpiceFileXferTask-s ref the channel

Hans de Goede hdegoede at redhat.com
Sat Mar 9 03:06:31 PST 2013


So that the channel sticks around while their callbacks are completing.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/channel-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index e3c8b41..e4b9f9e 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1518,6 +1518,7 @@ static void file_xfer_task_free(SpiceFileXferTask *task)
     c = task->channel->priv;
     c->file_xfer_task_list = g_list_remove(c->file_xfer_task_list, task);
 
+    g_clear_object(&task->channel);
     g_clear_object(&task->file);
     g_clear_object(&task->file_stream);
     g_free(task);
@@ -2684,7 +2685,7 @@ static void file_xfer_send_start_msg_async(SpiceMainChannel *channel,
 
     task = spice_malloc0(sizeof(SpiceFileXferTask));
     task->id = ++xfer_id;
-    task->channel = channel;
+    task->channel = g_object_ref(channel);
     task->file = g_object_ref(file);
     task->flags = flags;
     task->cancellable = cancellable;
-- 
1.8.1.4



More information about the Spice-devel mailing list