From 4519469547c0f8befe74e3e80a94efb0e076ba34 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 22 Sep 2020 21:21:47 +0100 Subject: Do not call into things we don't own in destructors - Remove improper accesses in cChunk destructor * Fixes #4894 --- src/World.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 3b82d9e97..ed29123b8 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -226,6 +226,7 @@ cWorld::cWorld( cFile::CreateFolderRecursive(m_DataPath); + // TODO: unique ptr unnecessary m_ChunkMap = std::make_unique(this); m_ChunkMap->TrackInDeadlockDetect(a_DeadlockDetect, m_WorldName); @@ -964,11 +965,6 @@ void cWorld::Stop(cDeadlockDetect & a_DeadlockDetect) m_MapManager.SaveMapData(); } - - // Explicitly destroy the chunkmap, so that it's guaranteed to be destroyed before the other internals - // This fixes crashes on stopping the server, because chunk destructor deletes entities and those access the world. - // TODO: destructors should only be used for releasing resources, not doing extra work - m_ChunkMap.reset(); } -- cgit v1.2.3