Fix #11585: Crash when cleaning AI/GS with nested AsyncMode.

Do not throw sanity check when in_shutdown is true. This is also applied to
ExecMode and TestMode as they follow the same pattern.
This commit is contained in:
Peter Nelson
2023-12-14 20:07:40 +00:00
committed by Peter Nelson
parent 47dd04d16c
commit bbf3028f89
4 changed files with 11 additions and 6 deletions

View File

@@ -31,8 +31,8 @@ ScriptExecMode::ScriptExecMode()
void ScriptExecMode::FinalRelease()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the script already died. */
if (!ScriptObject::GetActiveInstance()->IsDead()) {
/* Ignore this error if the script is not alive. */
if (ScriptObject::GetActiveInstance()->IsAlive()) {
throw Script_FatalError("ScriptExecMode object was removed while it was not the latest *Mode object created.");
}
}