summaryrefslogtreecommitdiffstats
path: root/source/ChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-27 21:40:57 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-27 21:40:57 +0200
commit08e14b3932df9d176c90930ea4d55fa802e10965 (patch)
tree557c86d7e90f673511e33782884165c508ff6089 /source/ChunkMap.cpp
parentNoise3D: Made settable through INI, added slight height control, added basic compositing (diff)
downloadcuberite-08e14b3932df9d176c90930ea4d55fa802e10965.tar
cuberite-08e14b3932df9d176c90930ea4d55fa802e10965.tar.gz
cuberite-08e14b3932df9d176c90930ea4d55fa802e10965.tar.bz2
cuberite-08e14b3932df9d176c90930ea4d55fa802e10965.tar.lz
cuberite-08e14b3932df9d176c90930ea4d55fa802e10965.tar.xz
cuberite-08e14b3932df9d176c90930ea4d55fa802e10965.tar.zst
cuberite-08e14b3932df9d176c90930ea4d55fa802e10965.zip
Diffstat (limited to 'source/ChunkMap.cpp')
-rw-r--r--source/ChunkMap.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp
index 6be49e399..7a7eeb25a 100644
--- a/source/ChunkMap.cpp
+++ b/source/ChunkMap.cpp
@@ -39,10 +39,11 @@ cChunkMap::cChunkMap(cWorld * a_World )
cChunkMap::~cChunkMap()
{
cCSLock Lock(m_CSLayers);
- for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr)
+ while (!m_Layers.empty())
{
- delete *itr;
- } // for itr - m_Layers[]
+ delete m_Layers.back();
+ m_Layers.pop_back(); // Must pop, because further chunk deletions query the chunkmap for entities and that would touch deleted data
+ }
}
@@ -1973,6 +1974,7 @@ cChunkMap::cChunkLayer::~cChunkLayer()
for (int i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
{
delete m_Chunks[i];
+ m_Chunks[i] = NULL; // // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data
} // for i - m_Chunks[]
}