diff options
| author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-08-30 21:14:07 +0200 |
|---|---|---|
| committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-08-30 21:14:07 +0200 |
| commit | 08214457a089264b3d8491bafcbbdcdbafb49e61 (patch) | |
| tree | c59a3613d0bad34498dc95c84964d973f6876180 /src/scripting/lua.cpp | |
| parent | 36611913651e26bcb580e7cca28b396a38a7f0fc (diff) | |
| download | manaserv-08214457a089264b3d8491bafcbbdcdbafb49e61.tar.gz manaserv-08214457a089264b3d8491bafcbbdcdbafb49e61.tar.xz manaserv-08214457a089264b3d8491bafcbbdcdbafb49e61.zip | |
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
Diffstat (limited to 'src/scripting/lua.cpp')
| -rw-r--r-- | src/scripting/lua.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 75a8ca2..579ae13 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; } |
