Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Technically more accurate semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
Causeless committed Dec 23, 2023
1 parent dc9dbc0 commit 8702446
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Entities/MovableObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,16 +533,17 @@ int MovableObject::Save(Writer &writer) const
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void MovableObject::DestroyScriptState() {
if (ObjectScriptsInitialized()) {
RunScriptedFunctionInAppropriateScripts("Destroy");

if (m_ThreadedLuaState) {
std::lock_guard<std::recursive_mutex> lock(m_ThreadedLuaState->GetMutex());
if (m_ThreadedLuaState) {
std::lock_guard<std::recursive_mutex> lock(m_ThreadedLuaState->GetMutex());
if (ObjectScriptsInitialized()) {
RunScriptedFunctionInAppropriateScripts("Destroy");
m_ThreadedLuaState->RunScriptString(m_ScriptObjectName + " = nil;");
m_ThreadedLuaState->UnregisterMO(this);
m_ThreadedLuaState = nullptr;
m_ScriptObjectName.clear();
}

m_ThreadedLuaState->UnregisterMO(this);
m_ThreadedLuaState = nullptr;
}
}

Expand Down

0 comments on commit 8702446

Please sign in to comment.