[Spice-commits] 2 commits - server/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Aug 11 09:12:12 UTC 2019


 server/tests/replay.c |   23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

New commits:
commit 3ebc6d4a435d18121470d730cee8f6aa72ffc018
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Jul 22 21:07:49 2019 +0100

    replay: Remove some leak and a FIXME
    
    Threads are joined by spice_server_destroy, just need to release
    last resources.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Snir Sheriber <ssheribe at redhat.com>

diff --git a/server/tests/replay.c b/server/tests/replay.c
index 992f26d6..44f24445 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -481,9 +481,8 @@ int main(int argc, char **argv)
     free_queue(cursor_queue);
     end_replay();
 
-    /* FIXME: there should be a way to join server threads before:
-     * g_main_loop_unref(loop);
-     */
+    g_main_loop_unref(loop);
+    basic_event_loop_destroy();
 
     return 0;
 }
commit 3af64b61dc5d565aea64cd528f5d24434c7fa5f6
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Jul 22 21:06:40 2019 +0100

    replay: Remove some goto statement
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Snir Sheriber <ssheribe at redhat.com>

diff --git a/server/tests/replay.c b/server/tests/replay.c
index e3ef7bf1..992f26d6 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -116,7 +116,7 @@ static gboolean fill_queue_idle(gpointer user_data)
         if (!cmd) {
             g_async_queue_push(display_queue, GINT_TO_POINTER(-1));
             g_async_queue_push(cursor_queue, GINT_TO_POINTER(-1));
-            goto end;
+            break;
         }
 
         ++ncommands;
@@ -133,7 +133,6 @@ static gboolean fill_queue_idle(gpointer user_data)
         }
     }
 
-end:
     if (!keep) {
         pthread_mutex_lock(&mutex);
         if (fill_source) {
@@ -153,17 +152,12 @@ static void fill_queue(void)
 {
     pthread_mutex_lock(&mutex);
 
-    if (!started)
-        goto end;
-
-    if (fill_source)
-        goto end;
-
-    fill_source = g_idle_source_new();
-    g_source_set_callback(fill_source, fill_queue_idle, NULL, NULL);
-    g_source_attach(fill_source, basic_event_loop_get_context());
+    if (started && fill_source == NULL) {
+        fill_source = g_idle_source_new();
+        g_source_set_callback(fill_source, fill_queue_idle, NULL, NULL);
+        g_source_attach(fill_source, basic_event_loop_get_context());
+    }
 
-end:
     pthread_mutex_unlock(&mutex);
 }
 


More information about the Spice-commits mailing list