drisw: Fix shared memory leak on drawable resize

XDestroyImage will mark the segment as to-be-destroyed, but it will
persist until we detach it, and we weren't doing so.

Cc: mesa-stable@lists.freedesktop.org
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/121
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Andreas Gottschling
2019-09-27 12:02:06 -04:00
committed by Adam Jackson
parent 90d58286cc
commit c5a2ccec5e

View File

@@ -56,6 +56,8 @@ XCreateDrawable(struct drisw_drawable * pdp, int shmid, Display * dpy)
if (pdp->ximage) { if (pdp->ximage) {
XDestroyImage(pdp->ximage); XDestroyImage(pdp->ximage);
pdp->ximage = NULL; pdp->ximage = NULL;
if ((pdp->shminfo.shmid > 0) && (shmid != pdp->shminfo.shmid))
XShmDetach(dpy, &pdp->shminfo);
} }
if (!xshm_error && shmid >= 0) { if (!xshm_error && shmid >= 0) {