- Merged a lot of these static destructor-only structs into regular
functions added to the exit chain with atterm so that they can be called in a deterministic order and not whatever order the linker decides to put them in. - Fixed: DCajunMaster did not free its getspawned. - Fixed: P_FreeLevelData() did not free ACS scripts. - Fixed: Level snapshots were not freed at exit. - Fixed: The save/load menu list was not freed at exit. - Fixed: FCompressedMemFile needs a destructor to free the m_ImplodedBuffer. - Fixed: G_DoLoadGame() did not free the engine string. - Fixed: M_ReadSaveStrings() did not free the engine string. - Fixed: Processing DEM_SAVEGAME did not free the pathname string. - Added a check for truncated flats to FFlatTexture::MakeTexture() because Heretic's F_SKY1 is only four bytes long. - Added a dump of the offending state to the "Cannot find state..." diagnostic. - Fixed: FCompressedFile did not initialize m_Mode in its default constructor. - Fixed: Heretic and Hexen status bars did not initialize ArtiRefresh. - Fixed: PNGHandle destructor should use delete[] to free TextChunks. SVN r111 (trunk)
This commit is contained in:
parent
01441cd4f0
commit
8fcf93d65a
68 changed files with 866 additions and 485 deletions
|
|
@ -74,6 +74,7 @@ CVAR (Bool, genglnodes, false, CVAR_SERVERINFO);
|
|||
CVAR (Bool, showloadtimes, false, 0);
|
||||
|
||||
static void P_InitTagLists ();
|
||||
static void P_Shutdown ();
|
||||
|
||||
//
|
||||
// MAP related Lookup tables.
|
||||
|
|
@ -2798,6 +2799,8 @@ void P_FreeLevelData ()
|
|||
level.total_monsters = level.total_items = level.total_secrets =
|
||||
level.killed_monsters = level.found_items = level.found_secrets =
|
||||
wminfo.maxfrags = 0;
|
||||
FBehavior::StaticUnloadModules ();
|
||||
level.behavior = NULL;
|
||||
if (vertexes != NULL)
|
||||
{
|
||||
delete[] vertexes;
|
||||
|
|
@ -2915,42 +2918,32 @@ void P_FreeLevelData ()
|
|||
|
||||
extern msecnode_t *headsecnode;
|
||||
|
||||
static struct AutoFreeLevelData
|
||||
void P_FreeExtraLevelData()
|
||||
{
|
||||
~AutoFreeLevelData()
|
||||
// Free all blocknodes and msecnodes.
|
||||
// *NEVER* call this function without calling
|
||||
// P_FreeLevelData() first, or they might not all be freed.
|
||||
{
|
||||
P_FreeLevelData();
|
||||
|
||||
// Blocknodes and msecnodes should be freed now, when we
|
||||
// can be sure they are all easily located in their
|
||||
// free lists.
|
||||
FBlockNode *node = FBlockNode::FreeBlocks;
|
||||
while (node != NULL)
|
||||
{
|
||||
FBlockNode *node = FBlockNode::FreeBlocks;
|
||||
while (node != NULL)
|
||||
{
|
||||
FBlockNode *next = node->NextBlock;
|
||||
delete node;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
{
|
||||
msecnode_t *node = headsecnode;
|
||||
|
||||
while (node != NULL)
|
||||
{
|
||||
msecnode_t *next = node->m_snext;
|
||||
free (node);
|
||||
node = next;
|
||||
}
|
||||
headsecnode = NULL;
|
||||
}
|
||||
if (StatusBar != NULL)
|
||||
{
|
||||
delete StatusBar;
|
||||
StatusBar = NULL;
|
||||
FBlockNode *next = node->NextBlock;
|
||||
delete node;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
} LevelDataFree_er;
|
||||
{
|
||||
msecnode_t *node = headsecnode;
|
||||
|
||||
while (node != NULL)
|
||||
{
|
||||
msecnode_t *next = node->m_snext;
|
||||
free (node);
|
||||
node = next;
|
||||
}
|
||||
headsecnode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_SetupLevel
|
||||
|
|
@ -3349,6 +3342,8 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
//
|
||||
void P_Init ()
|
||||
{
|
||||
atterm (P_Shutdown);
|
||||
|
||||
P_InitEffects (); // [RH]
|
||||
P_InitPicAnims ();
|
||||
P_InitSwitchList ();
|
||||
|
|
@ -3357,6 +3352,19 @@ void P_Init ()
|
|||
R_InitSprites ();
|
||||
}
|
||||
|
||||
static void P_Shutdown ()
|
||||
{
|
||||
R_DeinitSprites ();
|
||||
P_DeinitKeyMessages ();
|
||||
P_FreeLevelData ();
|
||||
P_FreeExtraLevelData ();
|
||||
if (StatusBar != NULL)
|
||||
{
|
||||
delete StatusBar;
|
||||
StatusBar = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
#include "c_dispatch.h"
|
||||
CCMD (lineloc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue