summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/x11/platform.cpp8
1 files changed, 8 insertions, 0 deletions
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;