fix replays occasionally crashing when stopping

due to R_ReInitColormaps our extra_colormaps pointer may be freed
so ensure it only gets called after gamestate has been set to GS_NULL so we dont risk doing this mid renderframe
fixes crashes in software and palette render mode
This commit is contained in:
Alug committed 2025-10-22 13:48:56 +02:00
1 parent a94740f5e9
commit 77f4d4ef3b
2 files changed
+8 -6

No files matched your search

+6 -5
View File
@@ -3411,11 +3411,6 @@ void G_StopDemo(void)
demo.rewinding = false;
CL_ClearRewinds();
if (gamestate == GS_LEVEL && rendermode != render_none)
{
V_SetPaletteLump("PLAYPAL"); // Reset the palette
R_ReInitColormaps(0, LUMPERROR);
}
if (gamestate == GS_INTERMISSION)
Y_EndIntermission(); // cleanup
if (gamestate == GS_VOTING)
@@ -3427,6 +3422,12 @@ void G_StopDemo(void)
wipegamestate = GS_NULL;
SV_StopServer();
SV_ResetServer();
if (gamestate == GS_LEVEL && rendermode != render_none)
{
V_SetPaletteLump("PLAYPAL"); // Reset the palette
R_ReInitColormaps(0, LUMPERROR);
}
}
// Stops timing a demo.
+2 -1
View File
@@ -943,9 +943,10 @@ void R_ExecuteSetViewSize(void)
memset(scalelight, 0xFF, sizeof(scalelight));
// Calculate the light levels to use for each level/scale combination.
for (i = 0; i< LIGHTLEVELS; i++)
for (i = 0; i < LIGHTLEVELS; i++)
{
startmapl = ((LIGHTLEVELS - 1 - i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
for (j = 0; j < MAXLIGHTSCALE; j++)
{
level = startmapl - j*vid.width/(viewwidth)/DISTMAP;