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:
parent
71ff634c95
commit
39449da304
|
@ -366,7 +366,7 @@ unsigned int NetPlayServer::OnConnect(ENetPeer* socket)
|
||||||
// called from ---NETPLAY--- thread
|
// called from ---NETPLAY--- thread
|
||||||
unsigned int NetPlayServer::OnDisconnect(const Client& player)
|
unsigned int NetPlayServer::OnDisconnect(const Client& player)
|
||||||
{
|
{
|
||||||
PlayerId pid = player.pid;
|
const PlayerId pid = player.pid;
|
||||||
|
|
||||||
if (m_is_running)
|
if (m_is_running)
|
||||||
{
|
{
|
||||||
|
@ -405,18 +405,18 @@ unsigned int NetPlayServer::OnDisconnect(const Client& player)
|
||||||
if (mapping == pid)
|
if (mapping == pid)
|
||||||
{
|
{
|
||||||
mapping = -1;
|
mapping = -1;
|
||||||
|
UpdatePadMapping();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdatePadMapping();
|
|
||||||
|
|
||||||
for (PadMapping& mapping : m_wiimote_map)
|
for (PadMapping& mapping : m_wiimote_map)
|
||||||
{
|
{
|
||||||
if (mapping == pid)
|
if (mapping == pid)
|
||||||
{
|
{
|
||||||
mapping = -1;
|
mapping = -1;
|
||||||
|
UpdateWiimoteMapping();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateWiimoteMapping();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue