Index: mesa-19.1.0/src/glx/drisw_glx.c =================================================================== --- mesa-19.1.0.orig/src/glx/drisw_glx.c 2019-06-11 15:12:51.000000000 +0000 +++ mesa-19.1.0/src/glx/drisw_glx.c 2019-09-12 09:50:31.411325087 +0000 @@ -84,10 +84,12 @@ static Bool XCreateDrawable(struct drisw_drawable * pdp, int shmid, Display * dpy) { if (pdp->ximage) { XDestroyImage(pdp->ximage); pdp->ximage = NULL; + if ((pdp->shminfo.shmid > 0) && ( shmid != pdp->shminfo.shmid)) + XShmDetach(dpy, &pdp->shminfo); } if (!xshm_error && shmid >= 0) { pdp->shminfo.shmid = shmid; pdp->ximage = XShmCreateImage(dpy,