mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- Fixed: FinalGC() needs to run before the type system is shut down.
- Fixed: Don't access class metadata at all in DObject::PropagateMark if the type system is shutdown. - Fixed: If FCompressedMemFile::Reopen() fails, then it would try to double-free memory when deleted. SVN r3688 (trunk)
This commit is contained in:
parent
970d5afcd2
commit
c197d0687c
5 changed files with 33 additions and 33 deletions
|
@ -2054,6 +2054,21 @@ 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
|
||||
|
@ -2072,6 +2087,7 @@ void D_DoomMain (void)
|
|||
|
||||
D_DoomInit();
|
||||
PClass::StaticInit ();
|
||||
atterm(FinalGC);
|
||||
|
||||
// [RH] Make sure zdoom.pk3 is always loaded,
|
||||
// as it contains magic stuff we need.
|
||||
|
|
|
@ -453,8 +453,9 @@ size_t DObject::PropagateMark()
|
|||
GC::Mark((DObject **)((BYTE *)this + *offsets));
|
||||
offsets++;
|
||||
}
|
||||
return info->Size;
|
||||
}
|
||||
return info->Size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t DObject::PointerSubstitution (DObject *old, DObject *notOld)
|
||||
|
|
|
@ -401,10 +401,13 @@ void FCompressedFile::Explode ()
|
|||
uLong newlen;
|
||||
|
||||
newlen = expandsize;
|
||||
_heapchk();
|
||||
r = uncompress (expand, &newlen, m_Buffer + 8, cprlen);
|
||||
if (r != Z_OK || newlen != expandsize)
|
||||
{
|
||||
_heapchk();
|
||||
M_Free (expand);
|
||||
_heapchk();
|
||||
I_Error ("Could not decompress cfile");
|
||||
}
|
||||
}
|
||||
|
@ -497,7 +500,18 @@ bool FCompressedMemFile::Reopen ()
|
|||
m_Mode = EReading;
|
||||
m_Buffer = m_ImplodedBuffer;
|
||||
m_SourceFromMem = true;
|
||||
Explode ();
|
||||
try
|
||||
{
|
||||
Explode ();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
// If we just leave things as they are, m_Buffer and m_ImplodedBuffer
|
||||
// both point to the same memory block and both will try to free it.
|
||||
m_Buffer = NULL;
|
||||
m_SourceFromMem = false;
|
||||
throw;
|
||||
}
|
||||
m_SourceFromMem = false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -138,20 +138,6 @@ void STACK_ARGS call_terms ()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FinalGC
|
||||
//
|
||||
// Collect garbage one last time before exiting.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static void FinalGC()
|
||||
{
|
||||
Args = NULL;
|
||||
GC::FullGC();
|
||||
}
|
||||
|
||||
static void STACK_ARGS NewFailure ()
|
||||
{
|
||||
I_FatalError ("Failed to allocate memory from system heap");
|
||||
|
@ -323,7 +309,6 @@ int main (int argc, char **argv)
|
|||
try
|
||||
{
|
||||
Args = new DArgs(argc, argv);
|
||||
atterm(FinalGC);
|
||||
|
||||
/*
|
||||
killough 1/98:
|
||||
|
|
|
@ -251,21 +251,6 @@ static void UnWTS (void)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// 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
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// LayoutErrorPane
|
||||
|
@ -828,7 +813,6 @@ void DoMain (HINSTANCE hInstance)
|
|||
#endif
|
||||
|
||||
Args = new DArgs(__argc, __argv);
|
||||
atterm(FinalGC);
|
||||
|
||||
// Under XP, get our session ID so we can know when the user changes/locks sessions.
|
||||
// Since we need to remain binary compatible with older versions of Windows, we
|
||||
|
|
Loading…
Reference in a new issue