Clear dangling pointers in VoteScreen struct after mapload

This commit is contained in:
indev authored and Alug committed 2025-09-05 20:06:52 +02:00
1 parent 03bbe1da50
commit 14203bdb3e
3 files changed
+19

No files matched your search

+2
View File
@@ -2901,6 +2901,8 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
//Patch_FreeTag(PU_PATCH_ROTATED); // we keep those ty!
Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1);
Y_VoteClear();
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
// clear the splats from previous level
R_ClearLevelSplats();
+16
View File
@@ -1576,6 +1576,22 @@ void Y_EndVote(void)
voteendtic = -1;
}
//
// Y_VoteClear
// Resets patches to prevent dangling pointers
//
void Y_VoteClear(void)
{
VoteScreen.bgpatch = NULL;
VoteScreen.widebgpatch = NULL;
for (size_t i = 0; i < sizeof(VoteScreen.cursor)/sizeof(VoteScreen.cursor[0]); ++i)
VoteScreen.cursor[i] = NULL;
VoteScreen.randomlvl = NULL;
VoteScreen.rubyicon = NULL;
}
//
// Y_SetupVoteFinish
//
+1
View File
@@ -22,6 +22,7 @@ void Y_StartVote(void);
void Y_EndVote(void);
void Y_SetupVoteFinish(SINT8 pick, SINT8 level);
void Y_VoteScreenCheck(void);
void Y_VoteClear(void);
typedef struct
{