From 4d368c6be40d2277dfb4002ad51e8fd26d2df7ff Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 4 Oct 2024 20:44:12 +0200 Subject: [PATCH] xv: 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/xvdix.h | 1 - Xext/xvmain.c | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Xext/xvdix.h b/Xext/xvdix.h index 38b599583..e1f33e1b4 100644 --- a/Xext/xvdix.h +++ b/Xext/xvdix.h @@ -174,7 +174,6 @@ typedef struct { int nAdaptors; XvAdaptorPtr pAdaptors; DestroyPixmapProcPtr DestroyPixmap; - CloseScreenProcPtr CloseScreen; } XvScreenRec, *XvScreenPtr; extern _X_EXPORT int XvScreenInit(ScreenPtr); diff --git a/Xext/xvmain.c b/Xext/xvmain.c index 4c455c537..f2b7de8ef 100644 --- a/Xext/xvmain.c +++ b/Xext/xvmain.c @@ -142,7 +142,7 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *); static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *); static Bool CreateResourceTypes(void); -static Bool XvCloseScreen(ScreenPtr); +static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr, void *arg); static Bool XvDestroyPixmap(PixmapPtr); static void XvResetProc(ExtensionEntry *); static int XvdiDestroyGrab(void *, XID); @@ -297,33 +297,29 @@ XvScreenInit(ScreenPtr pScreen) dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs); pxvs->DestroyPixmap = pScreen->DestroyPixmap; - pxvs->CloseScreen = pScreen->CloseScreen; dixScreenHookWindowDestroy(pScreen, XvWindowDestroy); + dixScreenHookClose(pScreen, XvScreenClose); pScreen->DestroyPixmap = XvDestroyPixmap; - pScreen->CloseScreen = XvCloseScreen; return Success; } -static Bool -XvCloseScreen(ScreenPtr pScreen) +static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused) { XvScreenPtr pxvs; pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey); dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy); + dixScreenUnhookClose(pScreen, XvScreenClose); pScreen->DestroyPixmap = pxvs->DestroyPixmap; - pScreen->CloseScreen = pxvs->CloseScreen; free(pxvs); dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL); - - return (*pScreen->CloseScreen) (pScreen); } static void