summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/sw
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/sw')
-rw-r--r--src/gallium/winsys/sw/xlib/xlib_sw_winsys.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
index 3aef8daa423..6e71530e635 100644
--- a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
+++ b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
@@ -165,6 +165,7 @@ alloc_shm_ximage(struct xlib_displaytarget *xlib_dt,
&xlib_dt->shminfo,
width, height);
if (xlib_dt->tempImage == NULL) {
+ shmctl(xlib_dt->shminfo.shmid, IPC_RMID, 0);
xlib_dt->shm = False;
return;
}
@@ -176,6 +177,11 @@ alloc_shm_ximage(struct xlib_displaytarget *xlib_dt,
XShmAttach(xlib_dt->display, &xlib_dt->shminfo);
XSync(xlib_dt->display, False);
+ /* Mark the segment to be destroyed, so that it is automatically destroyed
+ * when this process dies. Needs to be after XShmAttach() for *BSD.
+ */
+ shmctl(xlib_dt->shminfo.shmid, IPC_RMID, 0);
+
if (XErrorFlag) {
/* we are on a remote display, this error is normal, don't print it */
XFlush(xlib_dt->display);