[Spice-commits] src/spice-file-transfer-task.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 25 07:08:27 UTC 2019


 src/spice-file-transfer-task.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 2261e50a6411c58ab6fdaf02b04acfb54aebf936
Author: Jakub Janků <jjanku at redhat.com>
Date:   Mon Jun 24 19:55:20 2019 +0200

    file-transfer-task: emit signals in main context
    
    Parts of the internal file transfer task API can be invoked in the
    coroutine context, so in these cases use g_coroutine_signal_emit and
    g_coroutine_object_notify.
    
    Some functions (such as spice_main_channel_clipboard_selection_grab) wake
    up the channel and thus can immediately switch to the coroutine context.
    Delivering signals in the coroutine context as well, could theoretically
    lead to problems with reentrancy, since the user of spice-gtk does not
    expect this behavior.
    Spice-gtk, on the other hand, assumes that the public functions are called
    from the main context. So calling
    spice_main_channel_clipboard_selection_grab from the coroutine context
    prints an error as we try to switch to a coroutine we are already in.
    
    Such issues are probably not likely, but the fix is easy.
    
    Signed-off-by: Jakub Janků <jjanku at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/spice-file-transfer-task.c b/src/spice-file-transfer-task.c
index d0170da..90f31db 100644
--- a/src/spice-file-transfer-task.c
+++ b/src/spice-file-transfer-task.c
@@ -327,7 +327,7 @@ void spice_file_transfer_task_completed(SpiceFileTransferTask *self,
                                self);
     self->pending = TRUE;
 signal:
-    g_signal_emit(self, task_signals[SIGNAL_FINISHED], 0, self->error);
+    g_coroutine_signal_emit(self, task_signals[SIGNAL_FINISHED], 0, self->error);
     /* SpiceFileTransferTask unref is done after input stream is closed */
 }
 
@@ -433,8 +433,8 @@ void spice_file_transfer_task_read_async(SpiceFileTransferTask *self,
     /* Notify the progress prior the read to make the info be related to the
      * data that was already sent. To notify the 100% (completed), channel-main
      * should call read-async when it expects EOF. */
-    g_object_notify(G_OBJECT(self), "progress");
-    g_object_notify(G_OBJECT(self), "transferred-bytes");
+    g_coroutine_object_notify(G_OBJECT(self), "progress");
+    g_coroutine_object_notify(G_OBJECT(self), "transferred-bytes");
 
     task = g_task_new(self, self->cancellable, callback, userdata);
 


More information about the Spice-commits mailing list