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.
This commit is contained in:
Techjar 2018-07-10 18:35:37 -04:00
parent 71ff634c95
commit 39449da304
1 changed files with 3 additions and 3 deletions

View File

@ -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();
}
}
for (PadMapping& mapping : m_wiimote_map)
{
if (mapping == pid)
{
mapping = -1;
}
}
UpdateWiimoteMapping();
}
}
return 0;
}