Do not call into things we don't own in destructors
- Remove improper accesses in cChunk destructor * Fixes #4894
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user