Make glx destroy path handle cases where the X window goes away first.

This commit is contained in:
Kristian Høgsberg 2007-10-25 18:48:06 -04:00
parent 242f56f722
commit 30bcaa966d
2 changed files with 16 additions and 5 deletions

View File

@ -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,

View File

@ -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;