- try to keep the engine stable for as long as possible if a VM exception occurs in OnDestroy while running a cleanup.

This will still crash, but run long enough for the exception message to be visible.
This commit is contained in:
Christoph Oelckers 2022-10-20 16:48:18 +02:00
commit b6c5232fea
6 changed files with 12 additions and 11 deletions

View file

@ -271,7 +271,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
//
//==========================================================================
void FThinkerCollection::DestroyAllThinkers()
void FThinkerCollection::DestroyAllThinkers(bool fullgc)
{
int i;
bool error = false;
@ -285,11 +285,12 @@ void FThinkerCollection::DestroyAllThinkers()
}
}
error |= Thinkers[MAX_STATNUM + 1].DoDestroyThinkers();
GC::FullGC();
if (fullgc) GC::FullGC();
if (error)
{
ClearGlobalVMStack();
I_Error("DestroyAllThinkers failed");
if (fullgc) I_Error("DestroyAllThinkers failed");
else I_FatalError("DestroyAllThinkers failed");
}
}