From 08214457a089264b3d8491bafcbbdcdbafb49e61 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Tue, 30 Aug 2011 21:14:07 +0200 Subject: Made the monster removal not using queues to avoid a crash. A race condition on the being pointer could happen when the being queue was highly requested. IMHO, using queues to add being but remove them directly is the way to go. Resolves: Mana-Mantis #384 --- src/scripting/lua.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/scripting/lua.cpp') diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 75a8ca2c..579ae13a 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1156,14 +1156,14 @@ static int monster_change_anger(lua_State *s) */ static int monster_remove(lua_State *s) { - bool monsterEnqueued = false; + bool monsterRemoved = false; Monster *m = getMonster(s, 1); if (m) { - GameState::enqueueRemove(m); - monsterEnqueued = true; + GameState::remove(m); + monsterRemoved = true; } - lua_pushboolean(s, monsterEnqueued); + lua_pushboolean(s, monsterRemoved); return 1; } -- cgit v1.2.3-70-g09d2