summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-10-25 18:48:06 -0400
committerKristian Høgsberg <krh@redhat.com>2007-10-25 18:49:02 -0400
commit30bcaa966d6b00f1630609a78db18dee683cc43d (patch)
tree9692bed6096e3841df292b8572c86101c149407f
parent242f56f722243938e908d1957781ee53c2999783 (diff)
Make glx destroy path handle cases where the X window goes away first.
-rw-r--r--GL/glx/glxdri.c19
-rw-r--r--GL/glx/glxext.c2
2 files changed, 16 insertions, 5 deletions
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index 3688d50a8..5c45cd190 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -185,10 +185,14 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
- __glXenterServer(GL_FALSE);
- DRIDestroyDrawable(drawable->pDraw->pScreen,
- serverClient, drawable->pDraw);
- __glXleaveServer(GL_FALSE);
+ /* If the X window was destroyed, the dri DestroyWindow hook will
+ * aready have taken care of this, so only call if pDraw isn't NULL. */
+ if (drawable->pDraw != NULL) {
+ __glXenterServer(GL_FALSE);
+ DRIDestroyDrawable(drawable->pDraw->pScreen,
+ serverClient, drawable->pDraw);
+ __glXleaveServer(GL_FALSE);
+ }
xfree(private);
}
@@ -668,11 +672,16 @@ getDrawableInfo(__DRIdrawable *driDrawable,
{
__GLXDRIdrawable *drawable = containerOf(driDrawable,
__GLXDRIdrawable, driDrawable);
- ScreenPtr pScreen = drawable->base.pDraw->pScreen;
+ ScreenPtr pScreen;
drm_clip_rect_t *pClipRects, *pBackClipRects;
GLboolean retval;
size_t size;
+ /* If the X window has been destroyed, give up here. */
+ if (drawable->base.pDraw == NULL)
+ return GL_FALSE;
+
+ pScreen = drawable->base.pDraw->pScreen;
__glXenterServer(GL_FALSE);
retval = DRIGetDrawableInfo(pScreen, drawable->base.pDraw, index, stamp,
x, y, width, height,
diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c
index 546d87f01..772538940 100644
--- a/GL/glx/glxext.c
+++ b/GL/glx/glxext.c
@@ -122,6 +122,8 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
cx->pendingState |= __GLX_PENDING_DESTROY;
}
+ glxPriv->pDraw = NULL;
+ glxPriv->drawId = 0;
__glXUnrefDrawable(glxPriv);
return True;