Comment 23 for bug 328232

Revision history for this message
In , Jesse Barnes (jbarnes-virtuousgeek) wrote :

FYI, latest fix is from Michel (see below), hopefully it will be pushed soon.

diff --git a/glx/glxext.c b/glx/glxext.c
index c882372..e74d00e 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -119,17 +119,25 @@ static int ContextGone(__GLXcontext* cx, XID id)
 static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
 {
     ScreenPtr pScreen = glxPriv->pDraw->pScreen;
+ PixmapPtr pPixmap = NULL;
+ int refcount;

     switch (glxPriv->type) {
  case GLX_DRAWABLE_PIXMAP:
  case GLX_DRAWABLE_PBUFFER:
- (*pScreen->DestroyPixmap)((PixmapPtr) glxPriv->pDraw);
+ pPixmap = (PixmapPtr) glxPriv->pDraw;
      break;
     }

- glxPriv->pDraw = NULL;
- glxPriv->drawId = 0;
+ refcount = glxPriv->refCount;
     __glXUnrefDrawable(glxPriv);
+ if (refcount > 1) {
+ glxPriv->pDraw = NULL;
+ glxPriv->drawId = 0;
+ }
+
+ if (pPixmap)
+ (*pScreen->DestroyPixmap)(pPixmap);

     return True;
 }