- Repositioned the declaration of the file string in D_DoomMain() so that it

won't be left on the stack at exit.
- Fixed: PSymbol needs a virtual destructor so that PSymbolActionFunction can
  free its Arguments.
- Symbols for native classes are now freed on exit.


SVN r1022 (trunk)
This commit is contained in:
Randy Heit 2008-06-06 02:17:28 +00:00
parent a4dc93fb91
commit 2e28b0c9ce
5 changed files with 34 additions and 3 deletions

View file

@ -1,3 +1,10 @@
June 5, 2008
- Repositioned the declaration of the file string in D_DoomMain() so that it
won't be left around on the stack at exit.
- Fixed: PSymbol needs a virtual destructor so that PSymbolActionFunction can
free its Arguments.
- Symbols for native classes are now freed on exit.
June 4, 2008
- Removed the 8-character limit on endpic names from the parser. (Though it
might still be present in the texture manager; I don't remember.)

View file

@ -2059,7 +2059,6 @@ void D_MultiExec (DArgs *list, bool usePullin)
void D_DoomMain (void)
{
int p, flags;
FString file;
char *v;
const char *wad;
DArgs *execFiles;
@ -2096,6 +2095,8 @@ void D_DoomMain (void)
if (!(gameinfo.flags & GI_SHAREWARE))
{
FString file;
// [RH] zvox.wad - A wad I had intended to be automatically generated
// from Q2's pak0.pak so the female and cyborg player could have
// voices. I never got around to writing the utility to do it, though.
@ -2506,7 +2507,7 @@ void D_DoomMain (void)
v = Args->CheckValue ("-loadgame");
if (v)
{
file = v;
FString file(v);
FixPathSeperator (file);
DefaultExtension (file, ".zds");
G_LoadGame (file);

View file

@ -147,7 +147,10 @@ void PClass::StaticFreeData (PClass *type)
}
delete type;
}
else
{
type->Symbols.ReleaseSymbols();
}
}
void ClassReg::RegisterClass ()
@ -350,12 +353,22 @@ void PClass::FreeStateList ()
// Symbol tables ------------------------------------------------------------
PSymbol::~PSymbol()
{
}
PSymbolTable::~PSymbolTable ()
{
ReleaseSymbols();
}
void PSymbolTable::ReleaseSymbols()
{
for (unsigned int i = 0; i < Symbols.Size(); ++i)
{
delete Symbols[i];
}
Symbols.Clear();
}
void PSymbolTable::SetParentTable (PSymbolTable *parent)

View file

@ -15,6 +15,8 @@ enum ESymbolType
struct PSymbol
{
virtual ~PSymbol();
ESymbolType SymbolType;
FName SymbolName;
};
@ -75,6 +77,9 @@ public:
// not copied and will be freed when the symbol table is destroyed.
PSymbol *AddSymbol (PSymbol *sym);
// Frees all symbols from this table.
void ReleaseSymbols();
private:
PSymbolTable *ParentSymbolTable;
TArray<PSymbol *> Symbols;

View file

@ -1204,7 +1204,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
// every allocation and deallocation. This will be slow, but it can be a
// great help in finding problem areas.
//_CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF);
// Enable leak checking at exit.
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
// Use this to break at a specific allocation number.
//_crtBreakAlloc = 5501;
#endif
DoMain (hInstance);