summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-05-01 23:18:21 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-05-01 23:18:21 +0200
commit36754f20f8397f517e7d06673b017fc06afce09a (patch)
treee4fe6a4f52543c2ec25f17c8955c17306ea1bd72 /src
parentProper minecart DoSetSpeed Override (#3174) (diff)
downloadcuberite-36754f20f8397f517e7d06673b017fc06afce09a.tar
cuberite-36754f20f8397f517e7d06673b017fc06afce09a.tar.gz
cuberite-36754f20f8397f517e7d06673b017fc06afce09a.tar.bz2
cuberite-36754f20f8397f517e7d06673b017fc06afce09a.tar.lz
cuberite-36754f20f8397f517e7d06673b017fc06afce09a.tar.xz
cuberite-36754f20f8397f517e7d06673b017fc06afce09a.tar.zst
cuberite-36754f20f8397f517e7d06673b017fc06afce09a.zip
Diffstat (limited to 'src')
-rw-r--r--src/ChunkMap.cpp13
-rw-r--r--src/ChunkMap.h1
-rw-r--r--src/World.cpp2
3 files changed, 14 insertions, 2 deletions
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);
diff --git a/src/ChunkMap.h b/src/ChunkMap.h
index 8df76bde6..560987b4f 100644
--- a/src/ChunkMap.h
+++ b/src/ChunkMap.h
@@ -67,6 +67,7 @@ public:
static const int LAYER_SIZE = 32;
cChunkMap(cWorld * a_World);
+ ~cChunkMap();
// Broadcast respective packets to all clients of the chunk where the event is taking place
// (Please keep these alpha-sorted)
diff --git a/src/World.cpp b/src/World.cpp
index 9c30a3a07..e42e55825 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -215,8 +215,6 @@ cWorld::~cWorld()
delete m_LavaSimulator; m_LavaSimulator = nullptr;
delete m_RedstoneSimulator; m_RedstoneSimulator = nullptr;
- UnloadUnusedChunks();
-
m_Storage.WaitForFinish();
// Unload the scoreboard