From e33d1a989facdc949169692f862d046af9955a4c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Dec 2010 23:10:08 +0000 Subject: [PATCH] - 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) --- src/d_main.cpp | 3 ++- src/p_setup.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 81bca294b..aaeea7e3f 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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 (); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 7b45c8641..a62f5b5fc 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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) {