summaryrefslogtreecommitdiff
path: root/src/glx/dri2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/dri2.c')
-rw-r--r--src/glx/dri2.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index d70ec5a3ec..30999c899a 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -103,7 +103,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
/* Ignore swap events if we're not looking for them */
pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable);
- if (!(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+ if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
return False;
aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
@@ -175,6 +175,14 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code)
err->minorCode == X_DRI2CopyRegion)
return True;
+ /* If the X drawable was destroyed before the GLX drawable, the
+ * DRI2 drawble will be gone by the time we call
+ * DRI2DestroyDrawable. So just ignore BadDrawable here. */
+ if (err->majorCode == codes->major_opcode &&
+ err->errorCode == BadDrawable &&
+ err->minorCode == X_DRI2DestroyDrawable)
+ return True;
+
return False;
}