[PATCH 07/19] Free dispatchers at exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

---
 server/red-dispatcher.c | 7 +++++++
 server/red-dispatcher.h | 1 +
 server/reds.c           | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c
index 4b839a9..0425d6c 100644
--- a/server/red-dispatcher.c
+++ b/server/red-dispatcher.c
@@ -904,6 +904,13 @@ void red_dispatcher_async_complete(struct RedDispatcher *dispatcher,
     free(async_command);
 }
 
+void red_dispatcher_free(RedDispatcher *self)
+{
+    g_object_unref(self->dispatcher);
+    /* FIXME: free other stuff */
+    free(self);
+}
+
 void red_dispatcher_init(RedsState *reds, QXLInstance *qxl)
 {
     RedDispatcher *red_dispatcher;
diff --git a/server/red-dispatcher.h b/server/red-dispatcher.h
index 14a8079..2fe8cd9 100644
--- a/server/red-dispatcher.h
+++ b/server/red-dispatcher.h
@@ -26,6 +26,7 @@ typedef struct RedDispatcher RedDispatcher;
 typedef struct AsyncCommand AsyncCommand;
 
 void red_dispatcher_init(SpiceServer *reds, QXLInstance *qxl);
+void red_dispatcher_free(RedDispatcher *self);
 
 void red_dispatcher_set_mm_time(RedDispatcher *dispatcher, uint32_t);
 void red_dispatcher_on_ic_change(RedDispatcher *dispatcher, SpiceImageCompression ic);
diff --git a/server/reds.c b/server/reds.c
index d1b7d3b..b784310 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2757,9 +2757,11 @@ static int reds_init_ssl(RedsState *reds)
 static void reds_destroy_internal(RedsState *reds)
 {
     g_array_unref(reds->renderers);
+    g_object_unref(reds->main_dispatcher);
     if (reds->main_channel) {
         main_channel_close(reds->main_channel);
     }
+    g_list_free_full(reds->dispatchers, (GDestroyNotify)red_dispatcher_free);
 #ifdef RED_STATISTICS
     if (reds->stat_shm_name) {
         shm_unlink(reds->stat_shm_name);
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]