- 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:
Randy Heit 2006-05-12 03:14:40 +00:00
commit 8fcf93d65a
68 changed files with 866 additions and 485 deletions

View file

@ -91,12 +91,6 @@
// TYPES -------------------------------------------------------------------
struct GameAtExit
{
GameAtExit *Next;
char Command[1];
};
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
extern void M_RestoreMode ();
@ -117,7 +111,6 @@ void D_AddWildFile (const char *pattern);
void D_DoomLoop ();
static const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinprogdir=false);
static void STACK_ARGS DoConsoleAtExit ();
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
@ -221,7 +214,6 @@ static const char *IWADNames[] =
"strife0.wad",
NULL
};
static GameAtExit *ExitCmdList;
// CODE --------------------------------------------------------------------
@ -620,56 +612,6 @@ void D_Display (bool screenshot)
FrameCycles = cycles;
}
//==========================================================================
//
// DoConsoleAtExit
//
// Executes the contents of the atexit cvar, if any, at quit time.
//
//==========================================================================
static void STACK_ARGS DoConsoleAtExit ()
{
GameAtExit *cmd = ExitCmdList;
while (cmd != NULL)
{
GameAtExit *next = cmd->Next;
AddCommandString (cmd->Command);
free (cmd);
cmd = next;
}
}
//==========================================================================
//
// CCMD atexit
//
//==========================================================================
CCMD (atexit)
{
if (argv.argc() == 1)
{
Printf ("Registered atexit commands:\n");
GameAtExit *record = ExitCmdList;
while (record != NULL)
{
Printf ("%s\n", record->Command);
record = record->Next;
}
return;
}
for (int i = 1; i < argv.argc(); ++i)
{
GameAtExit *record = (GameAtExit *)M_Malloc (
sizeof(GameAtExit)+strlen(argv[i]));
strcpy (record->Command, argv[i]);
record->Next = ExitCmdList;
ExitCmdList = record;
}
}
//==========================================================================
//
// D_ErrorCleanup ()
@ -1905,12 +1847,9 @@ void D_DoomMain (void)
file[PATH_MAX-1] = 0;
#if defined(_MSC_VER) || defined(__GNUC__)
PClass::StaticInit ();
#endif
atterm (DObject::StaticShutdown);
atterm (DoConsoleAtExit);
PClass::StaticInit ();
atterm (C_DeinitConsole);
gamestate = GS_STARTUP;