[PATCH 2/2] glx: Destroy GLX drawables by the GLX XID

Kristian Høgsberg krh at bitplanet.net
Thu Apr 8 17:06:41 PDT 2010


The DestroyWindow hook only works when the GLX drawable XID is the same
as the X window XID.  This is only the case for drawables created
through the pre-GLX-1.3 compatibility mechanism.  GLX Drawables created
using glXCreateWindow get a different XID and we need to look up the
GLX private and pass the GLX XID to FreeResource instead.

Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
---
 glx/glxscreens.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 58d8ee0..b3dad33 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -353,8 +353,11 @@ glxDestroyWindow(WindowPtr pWin)
     ScreenPtr pScreen = pWin->drawable.pScreen;
     __GLXscreen *pGlxScreen = glxGetScreen(pScreen);
     Bool retval = TRUE;
+    __GLXdrawable *drawable;
 
-    FreeResource(pWin->drawable.id, FALSE);
+    drawable = glxGetDrawableFromWindow(pWin);
+    if (drawable != NULL)
+	FreeResource(drawable->drawId, FALSE);
 
     /* call lower wrapped functions */
     if (pGlxScreen->DestroyWindow) {
-- 
1.7.0.1



More information about the xorg-devel mailing list