(!1714) render: use window destructor hook

Wrapping ScreenRec's function pointers is problematic for many reasons, so
use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-20 17:31:03 +02:00
parent c4a9d03edc
commit 133970a44e
2 changed files with 4 additions and 13 deletions

View File

@ -63,13 +63,10 @@ PictureWindowFormat(WindowPtr pWindow)
WindowGetVisual(pWindow)); WindowGetVisual(pWindow));
} }
static Bool static void
PictureDestroyWindow(WindowPtr pWindow) picture_window_destructor(ScreenPtr pScreen, WindowPtr pWindow, void *arg)
{ {
ScreenPtr pScreen = pWindow->drawable.pScreen;
PicturePtr pPicture; PicturePtr pPicture;
PictureScreenPtr ps = GetPictureScreen(pScreen);
Bool ret;
while ((pPicture = GetPictureWindow(pWindow))) { while ((pPicture = GetPictureWindow(pWindow))) {
SetPictureWindow(pWindow, pPicture->pNext); SetPictureWindow(pWindow, pPicture->pNext);
@ -77,11 +74,6 @@ PictureDestroyWindow(WindowPtr pWindow)
FreeResource(pPicture->id, PictureType); FreeResource(pPicture->id, PictureType);
FreePicture((void *) pPicture, pPicture->id); FreePicture((void *) pPicture, pPicture->id);
} }
pScreen->DestroyWindow = ps->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWindow);
ps->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = PictureDestroyWindow;
return ret;
} }
static Bool static Bool
@ -693,12 +685,12 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->subpixel = SubPixelUnknown; ps->subpixel = SubPixelUnknown;
ps->CloseScreen = pScreen->CloseScreen; ps->CloseScreen = pScreen->CloseScreen;
ps->DestroyWindow = pScreen->DestroyWindow;
ps->StoreColors = pScreen->StoreColors; ps->StoreColors = pScreen->StoreColors;
pScreen->DestroyWindow = PictureDestroyWindow;
pScreen->CloseScreen = PictureCloseScreen; pScreen->CloseScreen = PictureCloseScreen;
pScreen->StoreColors = PictureStoreColors; pScreen->StoreColors = PictureStoreColors;
dixScreenHookWindowDestroy(pScreen, picture_window_destructor, NULL);
if (!PictureSetDefaultFilters(pScreen)) { if (!PictureSetDefaultFilters(pScreen)) {
PictureResetFilters(pScreen); PictureResetFilters(pScreen);
SetPictureScreen(pScreen, 0); SetPictureScreen(pScreen, 0);

View File

@ -294,7 +294,6 @@ typedef struct _PictureScreen {
GlyphsProcPtr Glyphs; /* unused */ GlyphsProcPtr Glyphs; /* unused */
CompositeRectsProcPtr CompositeRects; CompositeRectsProcPtr CompositeRects;
DestroyWindowProcPtr DestroyWindow;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
StoreColorsProcPtr StoreColors; StoreColorsProcPtr StoreColors;