From 08e14b3932df9d176c90930ea4d55fa802e10965 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 27 Apr 2013 19:40:57 +0000 Subject: Fixed a few possible crashes upon server stop git-svn-id: http://mc-server.googlecode.com/svn/trunk@1418 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ChunkMap.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/ChunkMap.cpp') 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[] } -- cgit v1.2.3