Fix #9353: [Script] Garbage collecting on priority queues could crash the game

(cherry picked from commit 71f3c35288)
This commit is contained in:
rubidium42
2021-06-12 16:45:26 +02:00
committed by Jonathan G Rennison
parent d46c764d60
commit 057e858d32
2 changed files with 6 additions and 3 deletions

View File

@@ -278,9 +278,12 @@ void ScriptInstance::GameLoop()
} }
} }
void ScriptInstance::CollectGarbage() const void ScriptInstance::CollectGarbage()
{ {
if (this->is_started && !this->IsDead()) this->engine->CollectGarbage(); if (this->is_started && !this->IsDead()) {
ScriptObject::ActiveInstance active(this);
this->engine->CollectGarbage();
}
} }
/* static */ void ScriptInstance::DoCommandReturn(ScriptInstance *instance) /* static */ void ScriptInstance::DoCommandReturn(ScriptInstance *instance)

View File

@@ -68,7 +68,7 @@ public:
/** /**
* Let the VM collect any garbage. * Let the VM collect any garbage.
*/ */
void CollectGarbage() const; void CollectGarbage();
/** /**
* Get the storage of this script. * Get the storage of this script.