[Spice-devel] [spice-gtk] main: channel-main to increase file-transfer reference

Victor Toso victortoso at redhat.com
Tue Jun 14 13:01:38 UTC 2016


This is a minor fix in the logic as in both situations (with or
without the patch) the reference count for the SpiceFileTransferTask
object is the same.

The change is interesting as SpiceFileTransferTask is created but on
g_file_read_async() it increases its reference count while
c->file_xfer_tasks keeps the original one.

It should be the other way around.
---
 src/channel-main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index 4736e13..7731943 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -3112,7 +3112,7 @@ static void file_xfer_send_start_msg_async(SpiceMainChannel *channel,
         CHANNEL_DEBUG(channel, "Insert a xfer task:%u to task list", task->id);
         g_hash_table_insert(c->file_xfer_tasks,
                             GUINT_TO_POINTER(task->id),
-                            task);
+                            g_object_ref(task));
         g_signal_connect(task, "finished", G_CALLBACK(task_finished), channel);
         g_signal_emit(channel, signals[SPICE_MAIN_NEW_FILE_TRANSFER], 0, task);
 
@@ -3120,7 +3120,7 @@ static void file_xfer_send_start_msg_async(SpiceMainChannel *channel,
                           G_PRIORITY_DEFAULT,
                           cancellable,
                           file_xfer_read_async_cb,
-                          g_object_ref(task));
+                          task);
         task->pending = TRUE;
 
         /* if we created a per-task cancellable above, free it */
-- 
2.5.5



More information about the Spice-devel mailing list