1
0
Fork 0

Fix Crash on stopping the server (#3176)

This commit is contained in:
LogicParrot 2016-05-02 00:18:21 +03:00
parent 5265c6aaf6
commit 36754f20f8
3 changed files with 14 additions and 2 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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