From 6116f899dee33a6d7bd887f7a57ace17df2ab94f Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Sun, 29 Mar 2020 21:58:19 +0100 Subject: Fix client disconnect assert (#4579) --- src/ClientHandle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 3a0eb1edd..40107153b 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -163,8 +163,8 @@ void cClientHandle::Destroy(void) LOGD("%s: destroying client %p, \"%s\" @ %s", __FUNCTION__, static_cast(this), m_Username.c_str(), m_IPString.c_str()); auto player = m_Player; - m_Self.reset(); - SetState(csDestroyed); // Tick thread is allowed to call destructor async at any time after this + auto Self = std::move(m_Self); // Keep ourself alive for at least as long as this function + SetState(csDestroyed); if (player == nullptr) { @@ -3350,7 +3350,7 @@ void cClientHandle::SetSelf(cClientHandlePtr a_Self) bool cClientHandle::SetState(eState a_NewState) { cCSLock Lock(m_CSState); - if (a_NewState < m_State) + if (a_NewState <= m_State) { return false; // Can only advance the state machine } -- cgit v1.2.3