miext: damage: revert 46f2a97c18

That commit causes damageCloseScreen to be called when is shouldn't be.
damageCloseScreen sets damageScrPriv(pScreen) to NULL
This causes segfaults when pScrPriv->funcs.{Unregister,Destroy} are
later called.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111 2025-07-01 20:16:40 +03:00
parent 01ba7a7f40
commit 61def30efe
2 changed files with 8 additions and 9 deletions

View File

@ -1567,21 +1567,20 @@ damageWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
} }
} }
static void damageCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused) static Bool
damageCloseScreen(ScreenPtr pScreen)
{ {
dixScreenUnhookClose(pScreen, damageCloseScreen); damageScrPriv(pScreen);
dixScreenUnhookWindowDestroy(pScreen, damageWindowDestroy); dixScreenUnhookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenUnhookPixmapDestroy(pScreen, damagePixmapDestroy); dixScreenUnhookPixmapDestroy(pScreen, damagePixmapDestroy);
damageScrPriv(pScreen);
if (!pScrPriv)
return;
unwrap(pScrPriv, pScreen, CreateGC); unwrap(pScrPriv, pScreen, CreateGC);
unwrap(pScrPriv, pScreen, CopyWindow); unwrap(pScrPriv, pScreen, CopyWindow);
unwrap(pScrPriv, pScreen, CloseScreen);
dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, NULL);
free(pScrPriv); free(pScrPriv);
return (*pScreen->CloseScreen) (pScreen);
} }
/** /**
@ -1667,13 +1666,13 @@ DamageSetup(ScreenPtr pScreen)
pScrPriv->internalLevel = 0; pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0; pScrPriv->pScreenDamage = 0;
dixScreenHookClose(pScreen, damageCloseScreen);
dixScreenHookWindowDestroy(pScreen, damageWindowDestroy); dixScreenHookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenHookPixmapDestroy(pScreen, damagePixmapDestroy); dixScreenHookPixmapDestroy(pScreen, damagePixmapDestroy);
wrap(pScrPriv, pScreen, CreateGC, damageCreateGC); wrap(pScrPriv, pScreen, CreateGC, damageCreateGC);
wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap); wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow); wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow);
wrap(pScrPriv, pScreen, CloseScreen, damageCloseScreen);
if (ps) { if (ps) {
wrap(pScrPriv, ps, Glyphs, damageGlyphs); wrap(pScrPriv, ps, Glyphs, damageGlyphs);
wrap(pScrPriv, ps, Composite, damageComposite); wrap(pScrPriv, ps, Composite, damageComposite);

View File

@ -61,7 +61,7 @@ typedef struct _damageScrPriv {
DamagePtr pScreenDamage; DamagePtr pScreenDamage;
CopyWindowProcPtr CopyWindow; CopyWindowProcPtr CopyWindow;
void *_dummy1; // required in place of a removed field for ABI compatibility CloseScreenProcPtr CloseScreen;
CreateGCProcPtr CreateGC; CreateGCProcPtr CreateGC;
void *_dummy2; // required in place of a removed field for ABI compatibility void *_dummy2; // required in place of a removed field for ABI compatibility
SetWindowPixmapProcPtr SetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap;