compext: use CloseScreen hook

Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-25 19:25:35 +02:00
parent 553ea7ebbe
commit 074fa9b0ba
2 changed files with 3 additions and 11 deletions

View File

@ -56,16 +56,13 @@ DevPrivateKeyRec CompScreenPrivateKeyRec;
DevPrivateKeyRec CompWindowPrivateKeyRec;
DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
static Bool
compCloseScreen(ScreenPtr pScreen)
static void compCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
CompScreenPtr cs = GetCompScreen(pScreen);
Bool ret;
free(cs->alternateVisuals);
free(cs->implicitRedirectExceptions);
pScreen->CloseScreen = cs->CloseScreen;
pScreen->InstallColormap = cs->InstallColormap;
pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
pScreen->ReparentWindow = cs->ReparentWindow;
@ -81,14 +78,12 @@ compCloseScreen(ScreenPtr pScreen)
pScreen->CopyWindow = cs->CopyWindow;
pScreen->SourceValidate = cs->SourceValidate;
dixScreenUnhookClose(pScreen, compCloseScreen);
dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy);
dixScreenUnhookWindowPosition(pScreen, compWindowPosition);
free(cs);
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
ret = (*pScreen->CloseScreen) (pScreen);
return ret;
}
static void
@ -370,6 +365,7 @@ compScreenInit(ScreenPtr pScreen)
if (!disableBackingStore)
pScreen->backingStoreSupport = WhenMapped;
dixScreenHookClose(pScreen, compCloseScreen);
dixScreenHookWindowDestroy(pScreen, compWindowDestroy);
dixScreenHookWindowPosition(pScreen, compWindowPosition);
@ -409,9 +405,6 @@ compScreenInit(ScreenPtr pScreen)
cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
cs->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = compCloseScreen;
cs->SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = compSourceValidate;

View File

@ -157,7 +157,6 @@ typedef struct _CompScreen {
Bool pendingScreenUpdate;
CloseScreenProcPtr CloseScreen;
int numAlternateVisuals;
VisualID *alternateVisuals;
int numImplicitRedirectExceptions;