Skip to content

Commit 0305917

Browse files
committed
Fixed crash when removing MO
1 parent e72201e commit 0305917

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Entities/MovableObject.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@ void MovableObject::Destroy(bool notInherited) {
557557
// TODO: try to make this at least reasonably workable
558558
//DestroyScriptState();
559559

560+
if (m_ThreadedLuaState) {
561+
m_ThreadedLuaState->UnregisterMO(this);
562+
}
563+
560564
g_MovableMan.UnregisterObject(this);
561565
if (!notInherited) {
562566
SceneObject::Destroy();

Managers/MovableMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ void MovableMan::Update()
17211721
LuaStateWrapper& luaState = luaStates[start];
17221722
g_LuaMan.SetThreadLuaStateOverride(&luaState);
17231723

1724-
for (MovableObject *mo : luaState.GetRegisteredMOs()) {
1724+
for (MovableObject *mo : luaState.GetRegisteredMOs()) {
17251725
mo->RunScriptedFunctionInAppropriateScripts(threadedUpdate, false, false, {}, {}, {});
17261726
}
17271727

0 commit comments

Comments
 (0)