summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-surface-shm.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-10-19 12:04:50 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-10-19 12:04:50 +0100
commit5041b462d084de8552336275914d30c23bf5dd35 (patch)
tree51e0950541326d1ffc19aa35a64ea98d613d2869 /src/cairo-xlib-surface-shm.c
parentd5f9c694b9145f0464c8bd58d844bddedcb77d5e (diff)
downloadcairo-5041b462d084de8552336275914d30c23bf5dd35.tar.gz
xlib/shm: Sync the XShmAttach before removing the ShmSegment id
Whilst reading through other users of XShm, it became apparent that IPC_RMID behaves differently across the platforms. Linux allows processes to attach to an existing ShmSegment id after a IPC_RMID, but for others the IPC_RMID takes immediate effect. On those platforms without a "deferred" IPC_RMID, we then need to perform the XShmAttach synchronously before perfomring the IPC_RMID. Reported-by: Thomas Klausner <wiz@NetBSD.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-xlib-surface-shm.c')
-rw-r--r--src/cairo-xlib-surface-shm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index ec8a6e1dd..ec0d334ef 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -449,6 +449,9 @@ _cairo_xlib_shm_pool_create(cairo_xlib_display_t *display,
pool->attached = NextRequest (dpy);
success = XShmAttach (dpy, &pool->shm);
+#if !IPC_RMID_DEFERRED_RELEASE
+ XSync (dpy, FALSE);
+#endif
shmctl (pool->shm.shmid, IPC_RMID, NULL);
if (! success)