From 36754f20f8397f517e7d06673b017fc06afce09a Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Mon, 2 May 2016 00:18:21 +0300 Subject: Fix Crash on stopping the server (#3176) --- src/ChunkMap.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 02666eaf6..7d1685210 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -51,6 +51,19 @@ cChunkMap::cChunkMap(cWorld * a_World) : +cChunkMap::~cChunkMap() +{ + // Explicitly destroy all chunks and ChunkLayers, so that they're guaranteed to be + // destroyed before other internals. This fixes crashes on stopping the server. + // because the chunk destructor deletes entities and those may access the chunkmap. + // Also, the cChunkData destructor accesses the chunkMap's allocator. + m_Layers.clear(); +} + + + + + void cChunkMap::RemoveLayer(cChunkLayer * a_Layer) { cCSLock Lock(m_CSLayers); -- cgit v1.2.3