channel-main uses the SpiceFileTransferTask reference given in the hash table provided by spice_file_transfer_task_create_tasks(). That means SpiceFileTransferTask is not holding a reference for itself but it relies on it due the async calls it provides. This patch increases the reference of each SpiceFileTransferTask for the hash table which will be unref'ed by channel-main in file_transfer_operation_task_finished(); the original reference is kept to SpiceFileTransferTask to be freed after the finish signal is emitted on spice_file_transfer_task_close_stream_cb(). This patch fixes some critical warnings as we have two g_object_unref but only one reference. --- src/spice-file-transfer-task.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spice-file-transfer-task.c b/src/spice-file-transfer-task.c index ca1b51d..8ebd256 100644 --- a/src/spice-file-transfer-task.c +++ b/src/spice-file-transfer-task.c @@ -304,6 +304,7 @@ void spice_file_transfer_task_completed(SpiceFileTransferTask *self, self->pending = TRUE; signal: g_signal_emit(self, task_signals[SIGNAL_FINISHED], 0, self->error); + /* SpiceFileTransferTask unref is done after inpust stream is closed */ } G_GNUC_INTERNAL @@ -374,7 +375,7 @@ GHashTable *spice_file_transfer_task_create_tasks(GFile **files, xfer_task->flags = flags; task_id = spice_file_transfer_task_get_id(xfer_task); - g_hash_table_insert(xfer_ht, GUINT_TO_POINTER(task_id), xfer_task); + g_hash_table_insert(xfer_ht, GUINT_TO_POINTER(task_id), g_object_ref(xfer_task)); /* if we created a per-task cancellable above, unref it */ if (!cancellable) -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel