mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- added explicit clearing of global VM stask
When exception is thrown from JITed code, VM stask isn't cleared during unwinding It needs to be clear explicitly to avoid memory leaks and references to destructed objects on shutdown https://forum.zdoom.org/viewtopic.php?t=66172
This commit is contained in:
parent
ed337b3ecc
commit
994960627b
4 changed files with 12 additions and 0 deletions
|
@ -984,6 +984,7 @@ void D_ErrorCleanup ()
|
|||
}
|
||||
if (gamestate == GS_INTERMISSION) gamestate = GS_DEMOSCREEN;
|
||||
insave = false;
|
||||
ClearGlobalVMStack();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -250,6 +250,7 @@ void FThinkerCollection::DestroyAllThinkers()
|
|||
GC::FullGC();
|
||||
if (error)
|
||||
{
|
||||
ClearGlobalVMStack();
|
||||
I_Error("DestroyAllThinkers failed");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ public:
|
|||
void ThrowAbortException(EVMAbortException reason, const char *moreinfo, ...);
|
||||
void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException reason, const char *moreinfo, ...);
|
||||
|
||||
void ClearGlobalVMStack();
|
||||
|
||||
struct VMReturn
|
||||
{
|
||||
void *Location;
|
||||
|
|
|
@ -715,6 +715,14 @@ void ThrowVMException(VMException *x)
|
|||
#endif
|
||||
|
||||
|
||||
void ClearGlobalVMStack()
|
||||
{
|
||||
while (GlobalVMStack.PopFrame() != nullptr)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ADD_STAT(VM)
|
||||
{
|
||||
double added = 0;
|
||||
|
|
Loading…
Reference in a new issue