diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-09-03 08:05:59 +0200 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-09-03 08:05:59 +0200 |
commit | 120286aef59dabdb7c9fa762e08457e5cc8ec3a6 (patch) | |
tree | 3dff8f557c91d7a98b366b8a0f7941f0c8deecfa /glx/glxscreens.c | |
parent | f04fe06ae244b851b38be824b1a80f2f8a030591 (diff) |
glx: Add screen DestroyWindow wrapper to destroy the GLX drawable.
Fixes crashes exitting MacSlow's rgba-glx demo.
Diffstat (limited to 'glx/glxscreens.c')
-rw-r--r-- | glx/glxscreens.c | 28 |
1 files changed, 28 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) { |