- tried to make 'restart' CCMD work again.

This requires quite a bit more thorough cleanup. I got it to the point where the titlepic appears after restarting, but it still crashes when starting the game so there's more data that needs to be cleaned up...
This commit is contained in:
Christoph Oelckers 2015-04-28 16:39:20 +02:00
parent 450e5aec52
commit 91b05366d6
4 changed files with 26 additions and 15 deletions

View File

@ -1973,8 +1973,6 @@ static void D_DoomInit()
M_FindResponseFile ();
atterm(FinalGC);
PClass::StaticInit();
PType::StaticInit();
// Combine different file parameters with their pre-switch bits.
Args->CollectFiles("-deh", ".deh");
@ -2261,7 +2259,8 @@ void D_DoomMain (void)
do
{
InitGlobalSymbols();
PClass::StaticInit();
PType::StaticInit();
if (restart)
{
@ -2637,6 +2636,8 @@ void D_DoomMain (void)
S_Shutdown(); // free all channels and delete playlist
C_ClearAliases(); // CCMDs won't be reinitialized so these need to be deleted here
DestroyCVarsFlagged(CVAR_MOD); // Delete any cvar left by mods
ReleaseGlobalSymbols();
PClass::StaticShutdown();
GC::FullGC(); // perform one final garbage collection before deleting the class data
restart++;

View File

@ -472,8 +472,17 @@ void PType::GetTypeIDs(intptr_t &id1, intptr_t &id2) const
//
//==========================================================================
void ReleaseGlobalSymbols()
{
TypeTable.Clear();
GlobalSymbols.ReleaseSymbols();
}
void PType::StaticInit()
{
// Add types to the global symbol table.
atterm(ReleaseGlobalSymbols);
// Set up TypeTable hash keys.
RUNTIME_CLASS(PErrorType)->TypeTableType = RUNTIME_CLASS(PErrorType);
RUNTIME_CLASS(PVoidType)->TypeTableType = RUNTIME_CLASS(PVoidType);
@ -517,18 +526,7 @@ void PType::StaticInit()
TypeTable.AddType(TypeState = new PStatePointer);
TypeTable.AddType(TypeFixed = new PFixed);
TypeTable.AddType(TypeAngle = new PAngle);
}
void ReleaseGlobalSymbols()
{
GlobalSymbols.ReleaseSymbols();
}
void InitGlobalSymbols()
{
// Add types to the global symbol table.
atterm(ReleaseGlobalSymbols);
GlobalSymbols.ReleaseSymbols();
GlobalSymbols.AddSymbol(new PSymbolType(NAME_sByte, TypeSInt8));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Byte, TypeUInt8));
GlobalSymbols.AddSymbol(new PSymbolType(NAME_Short, TypeSInt16));
@ -2061,6 +2059,17 @@ void PClass::StaticShutdown ()
}
TypeTable.Clear();
bShutdown = true;
AllClasses.Clear();
PClassActor::AllActorClasses.Clear();
FAutoSegIterator probe(CRegHead, CRegTail);
while (*++probe != NULL)
{
((ClassReg *)*probe)->MyClass = NULL;
}
}
//==========================================================================

View File

@ -801,6 +801,6 @@ public:
PSymbolConstString() {}
};
void InitGlobalSymbols();
void ReleaseGlobalSymbols();
#endif

View File

@ -170,6 +170,7 @@ DFsScript::DFsScript()
void DFsScript::Destroy()
{
if (this == global_script) global_script = NULL;
ClearVariables(true);
ClearSections();
ClearChildren();