shm: Don't mark the globally-initialized privates as uninitialized in a CloseScreen hook.

No need to mark anything, because duplicate dixRegisterPrivateKey() calls with same parameters are perfectly valid.
See: https://github.com/X11Libre/xserver/pull/1300

Fixes: https://github.com/X11Libre/xserver/commit/d220a0a9f0473c15d5001f4730613b482eb0e39

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111 2025-10-27 11:20:06 +02:00 committed by Enrico Weigelt
parent 04d4986004
commit 5b8ab55702

View File

@ -197,20 +197,16 @@ CheckForShmSyscall(void)
#endif
static Bool shmPrivatesRegistered = FALSE;
/* Multiple calls to dixRegisterPrivateKey with the same arguments are allowed */
static Bool
ShmRegisterPrivates(void)
{
if (shmPrivatesRegistered)
return TRUE;
if (!dixRegisterPrivateKey(&shmScrPrivateKeyRec, PRIVATE_SCREEN, sizeof(ShmScrPrivateRec)))
return FALSE;
if (!dixRegisterPrivateKey(&shmPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
return FALSE;
shmPrivatesRegistered = TRUE;
return TRUE;
}
@ -1361,12 +1357,6 @@ static void ShmPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr
dixSetPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey, NULL);
}
static void ShmCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
shmPrivatesRegistered = FALSE;
dixScreenUnhookClose(pScreen, ShmCloseScreen);
}
void
ShmExtensionInit(void)
{
@ -1391,7 +1381,6 @@ ShmExtensionInit(void)
screen_priv->shmFuncs = &miFuncs;
if (!screen_priv->shmFuncs->CreatePixmap)
sharedPixmaps = xFalse;
dixScreenHookClose(walkScreen, ShmCloseScreen);
});
if (sharedPixmaps)
DIX_FOR_EACH_SCREEN({