1
0
Fork 0

Fixed some logout crashes

This commit is contained in:
LogicParrot 2016-04-24 19:09:44 +03:00
parent 828889b890
commit 00e7b65d87
1 changed files with 3 additions and 2 deletions

View File

@ -124,7 +124,6 @@ cClientHandle::~cClientHandle()
{ {
RemoveFromAllChunks(); RemoveFromAllChunks();
m_Player->GetWorld()->RemoveClientFromChunkSender(this); m_Player->GetWorld()->RemoveClientFromChunkSender(this);
m_Player->SetIsTicking(false);
if (!m_Username.empty()) if (!m_Username.empty())
{ {
// Send the Offline PlayerList packet: // Send the Offline PlayerList packet:
@ -174,6 +173,8 @@ void cClientHandle::Destroy(void)
cWorld * World = m_Player->GetWorld(); cWorld * World = m_Player->GetWorld();
if (World != nullptr) if (World != nullptr)
{ {
m_Player->StopEveryoneFromTargetingMe();
m_Player->SetIsTicking(false);
World->RemovePlayer(m_Player, true); World->RemovePlayer(m_Player, true);
} }
m_Player->RemoveClientHandle(); m_Player->RemoveClientHandle();
@ -3084,7 +3085,7 @@ void cClientHandle::SocketClosed(void)
} }
if (m_Player != nullptr) if (m_Player != nullptr)
{ {
m_Player->GetWorld()->ScheduleTask(1, [this](cWorld & World) m_Player->GetWorld()->QueueTask([this](cWorld & World)
{ {
UNUSED(World); UNUSED(World);
Destroy(); Destroy();