Skip to content
Snippets Groups Projects
Commit 0ae75f2a authored by Loïc Blot's avatar Loïc Blot
Browse files

Player: Fix a deadlock triggered by previous commit 0e5e4973

parent 0e5e4973
No related branches found
No related tags found
No related merge requests found
......@@ -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())
......
......@@ -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 @@ class Player
}
u32 getFreeHudID() {
JMutexAutoLock lock(m_mutex);
size_t size = hud.size();
for (size_t i = 0; i != size; i++) {
if (!hud[i])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment