From 7c7e3efff31a8c225bb7029d08675aa617635a95 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 23 Aug 2010 17:11:39 +0200 Subject: client: Don't leak xshm segments --- client/x11/platform.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'client') diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 1b54bc39..f80f0dcf 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; -- cgit