- set all 'num' variables to 0 in P_FreeLevelData so that any code using them won't try to read the deleted map data.

SVN r3044 (trunk)
This commit is contained in:
Christoph Oelckers 2010-12-15 23:10:08 +00:00
parent 419a998bdf
commit e33d1a989f
2 changed files with 9 additions and 2 deletions

View file

@ -2317,6 +2317,8 @@ void D_DoomMain (void)
} }
else else
{ {
// let the renderer reinitialize some stuff if needed
screen->GameRestart();
// These calls from inside V_Init2 are still necessary // These calls from inside V_Init2 are still necessary
C_NewModeAdjust(); C_NewModeAdjust();
M_InitVideoModesMenu(); M_InitVideoModesMenu();
@ -2331,7 +2333,6 @@ void D_DoomMain (void)
catch (CRestartException &) catch (CRestartException &)
{ {
// Music and sound should be stopped first // Music and sound should be stopped first
screen->GameRestart();
S_StopMusic(true); S_StopMusic(true);
S_StopAllChannels (); S_StopAllChannels ();

View file

@ -3362,11 +3362,13 @@ void P_FreeLevelData ()
delete[] vertexes; delete[] vertexes;
vertexes = NULL; vertexes = NULL;
} }
numvertexes = 0;
if (segs != NULL) if (segs != NULL)
{ {
delete[] segs; delete[] segs;
segs = NULL; segs = NULL;
} }
numsegs = 0;
if (glsegextras != NULL) if (glsegextras != NULL)
{ {
delete[] glsegextras; delete[] glsegextras;
@ -3377,8 +3379,8 @@ void P_FreeLevelData ()
delete[] sectors[0].e; delete[] sectors[0].e;
delete[] sectors; delete[] sectors;
sectors = NULL; sectors = NULL;
numsectors = 0; // needed for the pointer cleanup code
} }
numsectors = 0;
if (gamenodes != NULL && gamenodes != nodes) if (gamenodes != NULL && gamenodes != nodes)
{ {
delete[] gamenodes; delete[] gamenodes;
@ -3411,11 +3413,14 @@ void P_FreeLevelData ()
delete[] lines; delete[] lines;
lines = NULL; lines = NULL;
} }
numlines = 0;
if (sides != NULL) if (sides != NULL)
{ {
delete[] sides; delete[] sides;
sides = NULL; sides = NULL;
} }
numsides = 0;
if (blockmaplump != NULL) if (blockmaplump != NULL)
{ {
delete[] blockmaplump; delete[] blockmaplump;
@ -3472,6 +3477,7 @@ void P_FreeLevelData ()
delete[] zones; delete[] zones;
zones = NULL; zones = NULL;
} }
numzones = 0;
P_FreeStrifeConversations (); P_FreeStrifeConversations ();
if (level.Scrolls != NULL) if (level.Scrolls != NULL)
{ {