xfree86: fbman: 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-29 13:27:56 +02:00
parent 0c39ca358e
commit 57b9155a7d

View File

@ -25,15 +25,14 @@
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "dix/screen_hooks_priv.h"
#include "misc.h"
#include "xf86.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "regionstr.h"
#include "xf86fbman.h"
@ -287,7 +286,6 @@ typedef struct {
FBLinkPtr UsedAreas;
int NumUsedAreas;
FBLinearLinkPtr LinearAreas;
CloseScreenProcPtr CloseScreen;
DevUnion *devPrivates;
} FBManager, *FBManagerPtr;
@ -1085,15 +1083,18 @@ static FBManagerFuncs xf86FBManFuncs = {
localPurgeUnlockedOffscreenAreas
};
static Bool
xf86FBCloseScreen(ScreenPtr pScreen)
static void xf86FBCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
FBLinkPtr pLink, tmp;
FBLinearLinkPtr pLinearLink, tmp2;
FBManagerPtr offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
xf86FBScreenKey);
pScreen->CloseScreen = offman->CloseScreen;
dixScreenUnhookClose(pScreen, xf86FBCloseScreen);
if (!offman)
return;
pLink = offman->UsedAreas;
while (pLink) {
@ -1115,8 +1116,6 @@ xf86FBCloseScreen(ScreenPtr pScreen)
free(offman->devPrivates);
free(offman);
dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
static Bool
@ -1178,9 +1177,7 @@ xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr FullRegion)
return FALSE;
dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
offman->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86FBCloseScreen;
dixScreenHookClose(pScreen, xf86FBCloseScreen);
offman->InitialBoxes = RegionCreate(NULL, 1);
offman->FreeBoxes = RegionCreate(NULL, 1);