Permalink
Browse files

NetPlay: Don't update mappings on leave if player had no mappings

This stops clients randomly deadlocking when a spectator leaves, as the mappings construct is not thread-safe and should not be written while the game is running.
  • Loading branch information...
Techjar committed Jul 10, 2018
1 parent 71ff634 commit 39449da3048e14ff36b3c6ced5d9965e8f7ba814
Showing with 3 additions and 3 deletions.
  1. +3 −3 Source/Core/Core/NetPlayServer.cpp
@@ -366,7 +366,7 @@ unsigned int NetPlayServer::OnConnect(ENetPeer* socket)
// called from ---NETPLAY--- thread
unsigned int NetPlayServer::OnDisconnect(const Client& player)
{
PlayerId pid = player.pid;
const PlayerId pid = player.pid;
if (m_is_running)
{
@@ -405,18 +405,18 @@ unsigned int NetPlayServer::OnDisconnect(const Client& player)
if (mapping == pid)
{
mapping = -1;
UpdatePadMapping();
}
}
UpdatePadMapping();
for (PadMapping& mapping : m_wiimote_map)
{
if (mapping == pid)
{
mapping = -1;
UpdateWiimoteMapping();
}
}
UpdateWiimoteMapping();
return 0;
}

0 comments on commit 39449da

Please sign in to comment.