Player: Fix a deadlock triggered by previous commit 0e5e49736c0a5fa29bca257bafc02d7c7...
authorLoic Blot <loic.blot@unix-experience.fr>
Sun, 22 Mar 2015 20:33:09 +0000 (21:33 +0100)
committerLoic Blot <loic.blot@unix-experience.fr>
Sun, 22 Mar 2015 20:33:09 +0000 (21:33 +0100)
src/player.cpp
src/player.h

index 88c5634e35441aeb9da937a5431f6a32e35454d4..08cb24248396a59e7d967bce1597b3a3eb6dfcf2 100644 (file)
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "player.h"
 
 #include <fstream>
+#include "jthread/jmutexautolock.h"
 #include "util/numeric.h"
 #include "hud.h"
 #include "constants.h"
@@ -241,6 +242,7 @@ void Player::deSerialize(std::istream &is, std::string playername)
 u32 Player::addHud(HudElement *toadd)
 {
        JMutexAutoLock lock(m_mutex);
+
        u32 id = getFreeHudID();
 
        if (id < hud.size())
index f38bd5615e463e672083af242773c72b014e4c16..d4698ea4a7e810509f7edc044e4b93daee8f4783 100644 (file)
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "irrlichttypes_bloated.h"
 #include "inventory.h"
 #include "constants.h" // BS
-#include "jthread/jmutexautolock.h"
+#include "jthread/jmutex.h"
 #include <list>
 
 #define PLAYERNAME_SIZE 20
@@ -204,7 +204,6 @@ public:
        }
 
        u32 getFreeHudID() {
-               JMutexAutoLock lock(m_mutex);
                size_t size = hud.size();
                for (size_t i = 0; i != size; i++) {
                        if (!hud[i])