- add a bit more stuff that needs to be done before a restart to ensure that all obsolete data is taken down.

(There's still a problem with the garbage collector kicking in and deleting stuff it's not supposed to, so Restart still doesn't work)
This commit is contained in:
Christoph Oelckers 2015-04-28 21:54:30 +02:00
parent 0f8972c96b
commit 407d38f3d6
2 changed files with 23 additions and 0 deletions

View File

@ -107,6 +107,8 @@
#include "resourcefiles/resourcefile.h" #include "resourcefiles/resourcefile.h"
#include "r_renderer.h" #include "r_renderer.h"
#include "p_local.h" #include "p_local.h"
#include "autosegs.h"
#include "fragglescript/t_fs.h"
EXTERN_CVAR(Bool, hud_althud) EXTERN_CVAR(Bool, hud_althud)
void DrawHUD(); void DrawHUD();
@ -2636,10 +2638,27 @@ void D_DoomMain (void)
S_Shutdown(); // free all channels and delete playlist S_Shutdown(); // free all channels and delete playlist
C_ClearAliases(); // CCMDs won't be reinitialized so these need to be deleted here C_ClearAliases(); // CCMDs won't be reinitialized so these need to be deleted here
DestroyCVarsFlagged(CVAR_MOD); // Delete any cvar left by mods DestroyCVarsFlagged(CVAR_MOD); // Delete any cvar left by mods
GC::FullGC(); // clean up before taking down the object list.
// Delete the VM functions here. The garbage collector will not do this automatically because they are referenced from the global action function definitions.
FAutoSegIterator probe(ARegHead, ARegTail);
while (*++probe != NULL)
{
AFuncDesc *afunc = (AFuncDesc *)*probe;
*(afunc->VMPointer) = NULL;
}
ReleaseGlobalSymbols(); ReleaseGlobalSymbols();
PClass::StaticShutdown(); PClass::StaticShutdown();
GC::FullGC(); // perform one final garbage collection before deleting the class data GC::FullGC(); // perform one final garbage collection before deleting the class data
for (DObject *obj = GC::Root; obj; obj = obj->ObjNext)
{
obj->ClearClass(); // Delete the Class pointer because the data it points to has been deleted. This will automatically be reset if needed.
}
restart++; restart++;
} }
} }

View File

@ -462,6 +462,10 @@ public:
void SerializeUserVars(FArchive &arc); void SerializeUserVars(FArchive &arc);
virtual void Serialize (FArchive &arc); virtual void Serialize (FArchive &arc);
void ClearClass()
{
Class = NULL;
}
// For catching Serialize functions in derived classes // For catching Serialize functions in derived classes
// that don't call their base class. // that don't call their base class.