(!1714) Xext: shm: 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
2024-09-27 19:09:59 +02:00
parent 07dc61c736
commit ce9f4c3876

View File

@@ -94,7 +94,6 @@ in this Software without prior written authorization from The Open Group.
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
ShmFuncsPtr shmFuncs;
DestroyPixmapProcPtr destroyPixmap;
} ShmScrPrivateRec;
@@ -193,15 +192,13 @@ CheckForShmSyscall(void)
#endif
static Bool
ShmCloseScreen(ScreenPtr pScreen)
static void
ShmScreenClose(ScreenPtr pScreen, void *arg)
{
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv);
return (*pScreen->CloseScreen) (pScreen);
}
static ShmScrPrivateRec *
@@ -211,9 +208,8 @@ ShmInitScreenPriv(ScreenPtr pScreen)
if (!screen_priv) {
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
dixScreenHookClose(pScreen, ShmScreenClose, NULL);
}
return screen_priv;
}