[Spice-devel] [PATCH spice-gtk] RFC: always release shm of primary surfaces

Marc-André Lureau marcandre.lureau at gmail.com
Wed Mar 21 11:53:29 PDT 2012


Note: I can't reproduce the leak, even after dozen of resolution switch.

Always delete shared memory segment of primary surfaces when
destroying its canvas.
---
 gtk/channel-display.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 152d6a7..8269705 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -705,6 +705,7 @@ static void destroy_canvas(display_surface *surface)
 #ifdef HAVE_SYS_SHM_H
     else {
         shmdt(surface->data);
+        shmctl(surface->shmid, IPC_RMID, 0);
     }
 #endif
     surface->shmid = -1;
@@ -815,11 +816,6 @@ static void display_handle_mode(SpiceChannel *channel, SpiceMsgIn *in)
     surface->size    = surface->height * surface->stride;
     surface->primary = true;
     create_canvas(channel, surface);
-#ifdef HAVE_SYS_SHM_H
-    if (surface->shmid != -1) {
-        shmctl(surface->shmid, IPC_RMID, 0);
-    }
-#endif
 }
 
 /* coroutine context */
-- 
1.7.7.6



More information about the Spice-devel mailing list