From 00e7b65d8785bd403f5df8e40f233f1a31d46577 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Sun, 24 Apr 2016 19:09:44 +0300 Subject: [PATCH] Fixed some logout crashes --- src/ClientHandle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 10fc66b21..8a45b0d6d 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -124,7 +124,6 @@ cClientHandle::~cClientHandle() { RemoveFromAllChunks(); m_Player->GetWorld()->RemoveClientFromChunkSender(this); - m_Player->SetIsTicking(false); if (!m_Username.empty()) { // Send the Offline PlayerList packet: @@ -174,6 +173,8 @@ void cClientHandle::Destroy(void) cWorld * World = m_Player->GetWorld(); if (World != nullptr) { + m_Player->StopEveryoneFromTargetingMe(); + m_Player->SetIsTicking(false); World->RemovePlayer(m_Player, true); } m_Player->RemoveClientHandle(); @@ -3084,7 +3085,7 @@ void cClientHandle::SocketClosed(void) } if (m_Player != nullptr) { - m_Player->GetWorld()->ScheduleTask(1, [this](cWorld & World) + m_Player->GetWorld()->QueueTask([this](cWorld & World) { UNUSED(World); Destroy();