[Spice-commits] 2 commits - src/channel-main.c

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Tue Jun 21 12:11:15 UTC 2016


 src/channel-main.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 7b947d4206ad32fe6994af7ab2e15c80b5ead5ad
Author: Victor Toso <victortoso at redhat.com>
Date:   Tue Jun 14 14:56:28 2016 +0200

    main: channel-main to increase file-transfer reference
    
    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.
    Acked-by: Marc-André Lureau <marcandre.lureau at gmail.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index 2f867c0..3d6ac2f 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -3121,7 +3121,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);
 
@@ -3129,7 +3129,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 */
commit f7a1914796bc40de4a594e35c23f1baf04a035e4
Author: Victor Toso <victortoso at redhat.com>
Date:   Tue Jun 14 13:48:54 2016 +0200

    main: assign variable after check for null
    
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index 1f27181..2f867c0 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -3180,12 +3180,13 @@ void spice_main_file_copy_async(SpiceMainChannel *channel,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data)
 {
-    SpiceMainChannelPrivate *c = channel->priv;
+    SpiceMainChannelPrivate *c;
 
     g_return_if_fail(channel != NULL);
     g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
     g_return_if_fail(sources != NULL);
 
+    c = channel->priv;
     if (!c->agent_connected) {
         g_task_report_new_error(channel,
                                 callback,


More information about the Spice-commits mailing list