summaryrefslogtreecommitdiff
path: root/src/player.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/player.h')
-rw-r--r--src/player.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/player.h b/src/player.h
index def428847..f38bd5615 100644
--- a/src/player.h
+++ b/src/player.h
@@ -23,6 +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 <list>
#define PLAYERNAME_SIZE 20
@@ -202,7 +203,8 @@ public:
return m_collisionbox;
}
- u32 getFreeHudID() const {
+ u32 getFreeHudID() {
+ JMutexAutoLock lock(m_mutex);
size_t size = hud.size();
for (size_t i = 0; i != size; i++) {
if (!hud[i])
@@ -318,6 +320,11 @@ protected:
bool m_dirty;
std::vector<HudElement *> hud;
+private:
+ // Protect some critical areas
+ // hud for example can be modified by EmergeThread
+ // and ServerThread
+ JMutex m_mutex;
};