[Spice-devel] [PATCH 2/2] client: Don't leak xshm segments
alexl at redhat.com
alexl at redhat.com
Mon Aug 23 08:15:00 PDT 2010
From: Alexander Larsson <alexl at redhat.com>
---
client/x11/platform.cpp | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 1b54bc3..f80f0dc 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -277,6 +277,14 @@ XImage *XPlatform::create_x_shm_image(RedDrawable::Format format,
goto err2;
}
+ /* Ensure the xserver has attached the xshm segment */
+ XSync (XPlatform::get_display(), False);
+
+ /* Mark segment as released so that it will be destroyed when
+ the xserver releases the segment. This way we won't leak
+ the segment if the client crashes. */
+ shmctl(shminfo->shmid, IPC_RMID, 0);
+
image->data = (char *)shminfo->shmaddr;
*shminfo_out = shminfo;
--
1.7.2.1
More information about the Spice-devel
mailing list