[Spice-commits] server/reds.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Fri Dec 2 17:39:33 UTC 2016


 server/reds.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 98f6767483a0fb1f0167a911a8169518c02fc025
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Dec 2 17:36:23 2016 +0000

    Rearrange object destruction
    
    Try to arrange destruction in the opposite order of the creation
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/reds.c b/server/reds.c
index 75f90c5..479a815 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3586,25 +3586,25 @@ SPICE_GNUC_VISIBLE int spice_server_init(SpiceServer *reds, SpiceCoreInterface *
 
 SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
 {
-    g_array_unref(reds->config->renderers);
-    g_array_unref(reds->config->video_codecs);
-    free(reds->config);
-    if (reds->main_channel) {
-        red_channel_destroy(RED_CHANNEL(reds->main_channel));
-    }
-    reds_cleanup(reds);
-
-    reds_core_timer_remove(reds, reds->mig_timer);
-
     /* remove the server from the list of servers so that we don't attempt to
      * free it again at exit */
     pthread_mutex_lock(&global_reds_lock);
     servers = g_list_remove(servers, reds);
     pthread_mutex_unlock(&global_reds_lock);
 
+    if (reds->main_channel) {
+        red_channel_destroy(RED_CHANNEL(reds->main_channel));
+    }
+    reds_core_timer_remove(reds, reds->mig_timer);
+    reds_cleanup(reds);
 #ifdef RED_STATISTICS
     stat_file_free(reds->stat_file);
 #endif
+
+    g_array_unref(reds->config->renderers);
+    g_array_unref(reds->config->video_codecs);
+    free(reds->config);
+
     free(reds);
 }
 


More information about the Spice-commits mailing list