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

View file

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