summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-09-03 08:05:59 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-09-03 08:05:59 +0200
commit120286aef59dabdb7c9fa762e08457e5cc8ec3a6 (patch)
tree3dff8f557c91d7a98b366b8a0f7941f0c8deecfa /glx
parentf04fe06ae244b851b38be824b1a80f2f8a030591 (diff)
glx: Add screen DestroyWindow wrapper to destroy the GLX drawable.
Fixes crashes exitting MacSlow's rgba-glx demo.
Diffstat (limited to 'glx')
-rw-r--r--glx/glxscreens.c28
-rw-r--r--glx/glxscreens.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 3fff26866..81faddd04 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -212,6 +212,7 @@ glxCloseScreen (int index, ScreenPtr pScreen)
__GLXscreen *pGlxScreen = glxGetScreen(pScreen);
pScreen->CloseScreen = pGlxScreen->CloseScreen;
+ pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
pGlxScreen->destroy(pGlxScreen);
@@ -395,6 +396,31 @@ pickFBConfig(__GLXscreen *pGlxScreen, VisualPtr visual)
return best;
}
+static Bool
+glxDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ __GLXscreen *pGlxScreen = glxGetScreen(pScreen);
+ Bool retval = TRUE;
+
+ FreeResource(pWin->drawable.id, FALSE);
+
+ /* call lower wrapped functions */
+ if (pGlxScreen->DestroyWindow) {
+ /* unwrap */
+ pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
+
+ /* call lower layers */
+ retval = (*pScreen->DestroyWindow)(pWin);
+
+ /* rewrap */
+ pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = glxDestroyWindow;
+ }
+
+ return retval;
+}
+
void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
{
__GLXconfig *m;
@@ -409,6 +435,8 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
pGlxScreen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = glxCloseScreen;
+ pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = glxDestroyWindow;
i = 0;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index 34e441e7c..3c1bdd4ba 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -162,6 +162,7 @@ struct __GLXscreen {
char *GLXextensions;
Bool (*CloseScreen)(int index, ScreenPtr pScreen);
+ Bool (*DestroyWindow)(WindowPtr pWindow);
};