Merge pull request #2136 from mc-server/clientDestroyRace
Fixed ClientHandle not getting properly removed from the world
This commit is contained in:
commit
1e297717e0
@ -2963,7 +2963,14 @@ void cClientHandle::SocketClosed(void)
|
|||||||
LOGD("Client %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str());
|
LOGD("Client %s @ %s disconnected", m_Username.c_str(), m_IPString.c_str());
|
||||||
cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected");
|
cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, "Player disconnected");
|
||||||
}
|
}
|
||||||
|
if (m_State < csDestroying)
|
||||||
|
{
|
||||||
|
cWorld * World = m_Player->GetWorld();
|
||||||
|
if (World != nullptr)
|
||||||
|
{
|
||||||
|
World->RemovePlayer(m_Player, true); // Must be called before cPlayer::Destroy() as otherwise cChunk tries to delete the player, and then we do it again
|
||||||
|
}
|
||||||
|
}
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user