mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-06 19:01:04 +03:00
Prevent clearing the event command list if the event system is not initialized
This fixes the issue where the game could crash (especially in optimized release) due to a memory corruption, because the event command list was deconstructed earlier
This commit is contained in:
parent
ddbdcc91dd
commit
581585a47c
2 changed files with 13 additions and 0 deletions
|
@ -533,6 +533,13 @@ void ScriptMaster::InitConstStrings(void)
|
||||||
AddString(ConstStrings[i]);
|
AddString(ConstStrings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Listener::EventSystemStarted) {
|
||||||
|
// Added in OPM
|
||||||
|
// This usually means the game module is getting destroyed
|
||||||
|
// most often, the event command list has been destroyed earlier
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Event::normalCommandList.clear();
|
Event::normalCommandList.clear();
|
||||||
Event::returnCommandList.clear();
|
Event::returnCommandList.clear();
|
||||||
Event::getterCommandList.clear();
|
Event::getterCommandList.clear();
|
||||||
|
|
|
@ -612,6 +612,12 @@ void L_ShutdownEvents(void)
|
||||||
|
|
||||||
Event::commandList.clear();
|
Event::commandList.clear();
|
||||||
Event::eventDefList.clear();
|
Event::eventDefList.clear();
|
||||||
|
#ifdef WITH_SCRIPT_ENGINE
|
||||||
|
Event::normalCommandList.clear();
|
||||||
|
Event::returnCommandList.clear();
|
||||||
|
Event::getterCommandList.clear();
|
||||||
|
Event::setterCommandList.clear();
|
||||||
|
#endif
|
||||||
|
|
||||||
Listener::EventSystemStarted = false;
|
Listener::EventSystemStarted = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue