- Since the scripting branch relies heavily on the garbage collector to clean up everything,

move the final GC back to after the type system has been shut down.

SVN r3760 (scripting)
This commit is contained in:
Randy Heit 2012-07-14 03:56:56 +00:00
parent 615f49572b
commit 136a2cd05a
3 changed files with 19 additions and 18 deletions

View file

@ -1805,6 +1805,22 @@ static void SetMapxxFlag()
if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx;
}
//==========================================================================
//
// FinalGC
//
// If this doesn't free everything, the debug CRT will let us know.
//
//==========================================================================
static void FinalGC()
{
Args = NULL;
GC::FinalGC = true;
GC::FullGC();
GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly
}
//==========================================================================
//
// Initialize
@ -1833,6 +1849,7 @@ static void D_DoomInit()
// Check response files before coalescing file parameters.
M_FindResponseFile ();
atterm(FinalGC);
PClass::StaticInit();
PType::StaticInit();
@ -2059,21 +2076,6 @@ static void CheckCmdLine()
}
}
//==========================================================================
//
// FinalGC
//
// If this doesn't free everything, the debug CRT will let us know.
//
//==========================================================================
static void FinalGC()
{
Args = NULL;
GC::FullGC();
GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly
}
//==========================================================================
//
// D_DoomMain
@ -2091,7 +2093,6 @@ void D_DoomMain (void)
int argcount;
D_DoomInit();
atterm(FinalGC);
// [RH] Make sure zdoom.pk3 is always loaded,
// as it contains magic stuff we need.

View file

@ -257,7 +257,7 @@ DObject::DObject (PClass *inClass)
DObject::~DObject ()
{
if (!(ObjectFlags & OF_Cleanup))
if (!(ObjectFlags & OF_Cleanup) && !PClass::bShutdown)
{
DObject **probe;
PClass *type = GetClass();

View file

@ -1285,7 +1285,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
// Use this to break at a specific allocation number.
//_crtBreakAlloc = 77624;
//_crtBreakAlloc = 18800;
#endif
DoMain (hInstance);