Skip to content

Commit 0ae75f2

Browse files
committedMar 22, 2015
Player: Fix a deadlock triggered by previous commit 0e5e497
1 parent 0e5e497 commit 0ae75f2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

Diff for: ‎src/player.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2020
#include "player.h"
2121

2222
#include <fstream>
23+
#include "jthread/jmutexautolock.h"
2324
#include "util/numeric.h"
2425
#include "hud.h"
2526
#include "constants.h"
@@ -241,6 +242,7 @@ void Player::deSerialize(std::istream &is, std::string playername)
241242
u32 Player::addHud(HudElement *toadd)
242243
{
243244
JMutexAutoLock lock(m_mutex);
245+
244246
u32 id = getFreeHudID();
245247

246248
if (id < hud.size())

Diff for: ‎src/player.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2323
#include "irrlichttypes_bloated.h"
2424
#include "inventory.h"
2525
#include "constants.h" // BS
26-
#include "jthread/jmutexautolock.h"
26+
#include "jthread/jmutex.h"
2727
#include <list>
2828

2929
#define PLAYERNAME_SIZE 20
@@ -204,7 +204,6 @@ class Player
204204
}
205205

206206
u32 getFreeHudID() {
207-
JMutexAutoLock lock(m_mutex);
208207
size_t size = hud.size();
209208
for (size_t i = 0; i != size; i++) {
210209
if (!hud[i])

0 commit comments

Comments
 (0)
Please sign in to comment.