diff options
author | Mattes D <github@xoft.cz> | 2017-06-26 09:11:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 09:11:30 +0200 |
commit | f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5 (patch) | |
tree | 45d75d208a39bea42107b22e31924801c789b509 /src/ClientHandle.cpp | |
parent | Corrected APIDoc for cBlockArea and exported missing functions (#3808) (diff) | |
download | cuberite-f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5.tar cuberite-f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5.tar.gz cuberite-f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5.tar.bz2 cuberite-f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5.tar.lz cuberite-f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5.tar.xz cuberite-f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5.tar.zst cuberite-f6bab71d055ad0e1bf908ffcd79ca4398b07fdc5.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index fe85ddfb8..1b63153d2 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -95,7 +95,7 @@ cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) : m_LastPlacedSign(0, -1, 0), m_ProtocolVersion(0) { - m_Protocol = new cProtocolRecognizer(this); + m_Protocol = cpp14::make_unique<cProtocolRecognizer>(this); s_ClientCount++; // Not protected by CS because clients are always constructed from the same thread m_UniqueID = s_ClientCount; @@ -143,8 +143,7 @@ cClientHandle::~cClientHandle() SendDisconnect("Server shut down? Kthnxbai"); } - delete m_Protocol; - m_Protocol = nullptr; + m_Protocol.reset(); LOGD("ClientHandle at %p deleted", static_cast<void *>(this)); } @@ -171,12 +170,13 @@ void cClientHandle::Destroy(void) } LOGD("%s: destroying client %p, \"%s\" @ %s", __FUNCTION__, static_cast<void *>(this), m_Username.c_str(), m_IPString.c_str()); + auto player = m_Player; + m_Self.reset(); { cCSLock lock(m_CSState); - m_State = csDestroyed; + m_State = csDestroyed; // Tick thread is allowed to call destructor async at any time after this } - auto player = m_Player; if (player != nullptr) { auto world = player->GetWorld(); |