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 4b4fba80e2
commit c14783ef81
2 changed files with 5 additions and 13 deletions

View File

@ -25,6 +25,7 @@
#include <dix-config.h>
#include "dix/colormap_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os/osdep.h"
#include "misc.h"
@ -63,13 +64,10 @@ PictureWindowFormat(WindowPtr pWindow)
WindowGetVisual(pWindow));
}
static Bool
PictureDestroyWindow(WindowPtr pWindow)
static void
picture_window_destructor(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
{
ScreenPtr pScreen = pWindow->drawable.pScreen;
PicturePtr pPicture;
PictureScreenPtr ps = GetPictureScreen(pScreen);
Bool ret;
while ((pPicture = GetPictureWindow(pWindow))) {
SetPictureWindow(pWindow, pPicture->pNext);
@ -77,11 +75,6 @@ PictureDestroyWindow(WindowPtr pWindow)
FreeResource(pPicture->id, PictureType);
FreePicture((void *) pPicture, pPicture->id);
}
pScreen->DestroyWindow = ps->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWindow);
ps->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = PictureDestroyWindow;
return ret;
}
static Bool
@ -693,12 +686,12 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->subpixel = SubPixelUnknown;
ps->CloseScreen = pScreen->CloseScreen;
ps->DestroyWindow = pScreen->DestroyWindow;
ps->StoreColors = pScreen->StoreColors;
pScreen->DestroyWindow = PictureDestroyWindow;
pScreen->CloseScreen = PictureCloseScreen;
pScreen->StoreColors = PictureStoreColors;
dixScreenHookWindowDestroy(pScreen, picture_window_destructor);
if (!PictureSetDefaultFilters(pScreen)) {
PictureResetFilters(pScreen);
SetPictureScreen(pScreen, 0);

View File

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