Skip to content

Commit

Permalink
Fix crash with stopEvent
Browse files Browse the repository at this point in the history
The server would crash when stopEvent was being called from an event on
the event itself.
  • Loading branch information
marksamman committed Jan 27, 2014
1 parent 3d9cf01 commit 5467f57
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12193,7 +12193,8 @@ void LuaEnvironment::executeTimerEvent(uint32_t eventIndex)
return;
}

const LuaTimerEventDesc& timerEventDesc = it->second;
LuaTimerEventDesc timerEventDesc = std::move(it->second);
m_timerEvents.erase(it);

//push function
lua_rawgeti(m_luaState, LUA_REGISTRYINDEX, timerEventDesc.function);
Expand All @@ -12218,6 +12219,4 @@ void LuaEnvironment::executeTimerEvent(uint32_t eventIndex)
for (auto parameter : timerEventDesc.parameters) {
luaL_unref(m_luaState, LUA_REGISTRYINDEX, parameter);
}

m_timerEvents.erase(it);
}

0 comments on commit 5467f57

Please sign in to comment.