Module Name:    xsrc
Committed By:   maya
Date:           Fri May 31 18:01:11 UTC 2019

Modified Files:
        xsrc/external/mit/xorg-server/dist/glx: glxcmds.c glxdrawable.h
            glxext.c

Log Message:
Undo local diff.

It was introduced as one of the patches fixing
https://bugs.freedesktop.org/show_bug.cgi?id=28181

This is marked fixed upstream, and was spotted on non-NetBSD, so it's
very likely to be unnecessary.

This diff was causing a double-free, causing Xorg to crash when closing
pkgsrc/emulators/{retroarch,nestopia}.
This is most likely a problem that became more evident from jemalloc
debug which is filling free'd memory with 0x5a5a5a...

Fixes PR xsrc/54246.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h
cvs rdiff -u -r1.7 -r1.8 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.11 xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.12
--- xsrc/external/mit/xorg-server/dist/glx/glxcmds.c:1.11	Mon Dec 31 09:49:59 2018
+++ xsrc/external/mit/xorg-server/dist/glx/glxcmds.c	Fri May 31 18:01:11 2019
@@ -1137,7 +1137,6 @@ __glXDrawableInit(__GLXdrawable * drawab
     drawable->pDraw = pDraw;
     drawable->type = type;
     drawable->drawId = drawId;
-    drawable->otherId = 0;
     drawable->config = config;
     drawable->eventMask = 0;
 
@@ -1172,10 +1171,8 @@ DoCreateGLXDrawable(ClientPtr client, __
      * Windows aren't refcounted, so track both the X and the GLX window
      * so we get called regardless of destruction order.
      */
-    // XXXMRG xorg-server 1.10
-    if (drawableId != glxDrawableId && (type == GLX_DRAWABLE_WINDOW /*|| type == GLX_DRAWABLE_PIXMAP*/) &&
+    if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW &&
         !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw))
-	/*pGlxDraw->destroy (pGlxDraw);*/
         return BadAlloc;
 
     return Success;

Index: xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h
diff -u xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.6 xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.7
--- xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h:1.6	Mon Dec 31 09:49:59 2018
+++ xsrc/external/mit/xorg-server/dist/glx/glxdrawable.h	Fri May 31 18:01:11 2019
@@ -53,7 +53,6 @@ struct __GLXdrawable {
 
     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.7 xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.8
--- xsrc/external/mit/xorg-server/dist/glx/glxext.c:1.7	Mon Dec 31 09:49:59 2018
+++ xsrc/external/mit/xorg-server/dist/glx/glxext.c	Fri May 31 18:01:11 2019
@@ -97,15 +97,13 @@ DrawableGone(__GLXdrawable * glxPriv, XI
 {
     __GLXcontext *c, *next;
 
-    if (glxPriv->type == GLX_DRAWABLE_WINDOW || glxPriv->type == GLX_DRAWABLE_PIXMAP) {
+    if (glxPriv->type == GLX_DRAWABLE_WINDOW) {
         /* If this was created by glXCreateWindow, free the matching resource */
-        if (glxPriv->otherId) {
-            XID other = glxPriv->otherId;
-            glxPriv->otherId = 0;
-            if (xid == other)
-                FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
+        if (glxPriv->drawId != glxPriv->pDraw->id) {
+            if (xid == glxPriv->drawId)
+                FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
             else
-                FreeResourceByType(other, __glXDrawableRes, TRUE);
+                FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
         }
         /* otherwise this window was implicitly created by MakeCurrent */
     }

Reply via email to