1
0

Do not call into things we don't own in destructors

- Remove improper accesses in cChunk destructor
* Fixes #4894
This commit is contained in:
Tiger Wang
2020-09-22 21:21:47 +01:00
parent 10bd15a11e
commit 4519469547
9 changed files with 35 additions and 55 deletions

View File

@@ -226,6 +226,7 @@ cWorld::cWorld(
cFile::CreateFolderRecursive(m_DataPath);
// TODO: unique ptr unnecessary
m_ChunkMap = std::make_unique<cChunkMap>(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();
}