1
0

Fixed a few possible crashes upon server stop

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1418 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-04-27 19:40:57 +00:00
parent f34cbb9e76
commit 08e14b3932

View File

@ -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[]
}