From 4497e36cb5a6d880dfa3ca2fbdf1c82d72330514 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 27 Sep 2024 19:09:59 +0200 Subject: [PATCH] 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 --- Xext/shm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Xext/shm.c b/Xext/shm.c index e4cbf21dd..c698bb591 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. #include #include "dix/dix_priv.h" +#include "dix/screen_hooks_priv.h" #include "os/auth.h" #include "os/busfault.h" #include "os/client_priv.h" @@ -96,7 +97,6 @@ in this Software without prior written authorization from The Open Group. #endif /* XINERAMA */ typedef struct _ShmScrPrivateRec { - CloseScreenProcPtr CloseScreen; ShmFuncsPtr shmFuncs; DestroyPixmapProcPtr destroyPixmap; } ShmScrPrivateRec; @@ -195,15 +195,13 @@ CheckForShmSyscall(void) #endif -static Bool -ShmCloseScreen(ScreenPtr pScreen) +static void +ShmScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused) { ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen); - pScreen->CloseScreen = screen_priv->CloseScreen; dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL); free(screen_priv); - return (*pScreen->CloseScreen) (pScreen); } static ShmScrPrivateRec * @@ -213,9 +211,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); } return screen_priv; }