dix: let FreeGCperDepth() operate on ScreenPtr and NULL protect it

Instead of retrieving the screen index from ScreenRec and passing this,
so the ScreenRec is looked up again, just pass in the ScreenPtr that
already have anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-03-13 13:13:47 +01:00
parent 1eaf1b0191
commit d56d8307c1
3 changed files with 6 additions and 5 deletions

View File

@ -821,13 +821,14 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
}
void
FreeGCperDepth(int screenNum)
FreeGCperDepth(ScreenPtr pScreen)
{
int i;
ScreenPtr pScreen;
GCPtr *ppGC;
pScreen = screenInfo.screens[screenNum];
if (!pScreen)
return;
ppGC = pScreen->GCperDepth;
for (i = 0; i <= pScreen->numDepths; i++) {

View File

@ -22,7 +22,7 @@ int CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask);
int FreeGC(void *pGC, XID gid);
void FreeGCperDepth(int screenNum);
void FreeGCperDepth(ScreenPtr pScreen);
Bool CreateGCperDepth(int screenNum);

View File

@ -334,7 +334,7 @@ dix_main(int argc, char *argv[], char *envp[])
}
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
FreeGCperDepth(i);
FreeGCperDepth(screenInfo.screens[i]);
FreeDefaultStipple(i);
dixFreeScreenSpecificPrivates(screenInfo.screens[i]);
(*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]);