Permalink
Browse files

Fix Destroy() calling behaviour

* Fixes Core/#142
  • Loading branch information...
tigerw committed May 29, 2015
1 parent 1dfc7bb commit 291370e367f9c51f894ff132860ac2b55727181f
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/ClientHandle.cpp
View
@@ -2181,11 +2181,12 @@ void cClientHandle::SendDestroyEntity(const cEntity & a_Entity)
void cClientHandle::SendDisconnect(const AString & a_Reason)
{
// Destruction (Destroy()) is called when the client disconnects, not when a disconnect packet (or anything else) is sent
// Otherwise, the cClientHandle instance is can be unexpectedly removed from the associated player - Core/#142
if (!m_HasSentDC)
{
LOGD("Sending a DC: \"%s\"", StripColorCodes(a_Reason).c_str());
m_Protocol->SendDisconnect(a_Reason);
Destroy();
m_HasSentDC = true;
}
}

1 comment on commit 291370e

@tigerw

This comment has been minimized.

Show comment
Hide comment
@tigerw

tigerw May 29, 2015

Member

Whoops. Fixes cuberite/Core#142

Member

tigerw commented on 291370e May 29, 2015

Whoops. Fixes cuberite/Core#142

Please sign in to comment.