mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- 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:
parent
0f8972c96b
commit
407d38f3d6
2 changed files with 23 additions and 0 deletions
|
@ -107,6 +107,8 @@
|
|||
#include "resourcefiles/resourcefile.h"
|
||||
#include "r_renderer.h"
|
||||
#include "p_local.h"
|
||||
#include "autosegs.h"
|
||||
#include "fragglescript/t_fs.h"
|
||||
|
||||
EXTERN_CVAR(Bool, hud_althud)
|
||||
void DrawHUD();
|
||||
|
@ -2636,10 +2638,27 @@ 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
|
||||
|
||||
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();
|
||||
PClass::StaticShutdown();
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -462,6 +462,10 @@ public:
|
|||
|
||||
void SerializeUserVars(FArchive &arc);
|
||||
virtual void Serialize (FArchive &arc);
|
||||
void ClearClass()
|
||||
{
|
||||
Class = NULL;
|
||||
}
|
||||
|
||||
// For catching Serialize functions in derived classes
|
||||
// that don't call their base class.
|
||||
|
|
Loading…
Reference in a new issue