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

Hans de Goede hdegoede at redhat.com
Fri Mar 29 04:40:20 PDT 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 8e8a3a5..bd27ef4 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1547,6 +1547,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);
@@ -2679,7 +2680,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