Module Name: xsrc
Committed By: mrg
Date: Tue Aug 2 07:16:37 UTC 2011
Modified Files:
xsrc/external/mit/xorg-server/dist/glx: glxcmds.c glxdrawable.h
glxext.c
Log Message:
re-apply the fix for https://bugs.freedesktop.org/show_bug.cgi?id=28181,
from the comment #40 from this bug.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xorg-server/dist/glx/glxext.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xorg-server/dist/glx/glxcmds.c
diff -u xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.5 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.6
--- xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.5 Tue Aug 2 07:15:02 2011
+++ xsrc/external/mit/xorg-server/dist/glx/glxcmds.c Tue Aug 2 07:16:36 2011
@@ -1095,6 +1095,7 @@
drawable->pDraw = pDraw;
drawable->type = type;
drawable->drawId = drawId;
+ drawable->otherId = 0;
drawable->config = config;
drawable->eventMask = 0;
@@ -1131,10 +1132,13 @@
* Windows aren't refcounted, so track both the X and the GLX window
* so we get called regardless of destruction order.
*/
- if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
- !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
- pGlxDraw->destroy (pGlxDraw);
- return BadAlloc;
+ if (drawableId != glxDrawableId &&
+ (type == GLX_DRAWABLE_WINDOW || type == GLX_DRAWABLE_PIXMAP)) {
+ if (!AddResource(drawableId, __glXDrawableRes, pGlxDraw)) {
+ pGlxDraw->destroy (pGlxDraw);
+ return BadAlloc;
+ }
+ pGlxDraw->otherId = drawableId;
}
return Success;
Index: xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h
diff -u xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.3 xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.4
--- xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.3 Tue Aug 2 07:13:20 2011
+++ xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h Tue Aug 2 07:16:36 2011
@@ -53,6 +53,7 @@
DrawablePtr pDraw;
XID drawId;
+ XID otherId; /* for glx1.3 we need to track the original Drawable as well */
/*
** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or
Index: xsrc/external/mit/xorg-server/dist/glx/glxext.c
diff -u xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.4 xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.5
--- xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.4 Tue Aug 2 07:15:02 2011
+++ xsrc/external/mit/xorg-server/dist/glx/glxext.c Tue Aug 2 07:16:37 2011
@@ -124,13 +124,15 @@
{
__GLXcontext *c, *next;
- if (glxPriv->type == GLX_DRAWABLE_WINDOW) {
+ if (glxPriv->type == GLX_DRAWABLE_WINDOW || glxPriv->type == GLX_DRAWABLE_PIXMAP) {
/* If this was created by glXCreateWindow, free the matching resource */
- if (glxPriv->drawId != glxPriv->pDraw->id) {
- if (xid == glxPriv->drawId)
- FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
- else
+ if (glxPriv->otherId) {
+ XID other = glxPriv->otherId;
+ glxPriv->otherId = 0;
+ if (xid == other)
FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
+ else
+ FreeResourceByType(other, __glXDrawableRes, TRUE);
}
/* otherwise this window was implicitly created by MakeCurrent */
}