1
0
Fork 0

ChunkStay must be disabled while being deleted.

Fixes #758.
This commit is contained in:
madmaxoft 2014-04-12 22:35:04 +02:00
parent 75b7244f05
commit 34cf058b02
3 changed files with 6 additions and 4 deletions

View File

@ -31,10 +31,7 @@ cChunkStay::~cChunkStay()
void cChunkStay::Clear(void)
{
if (m_ChunkMap != NULL)
{
Disable();
}
ASSERT(m_ChunkMap == NULL);
m_Chunks.clear();
}

View File

@ -36,8 +36,12 @@ class cChunkStay
{
public:
cChunkStay(void);
/** Deletes the object. Note that this calls Clear(), which means that the ChunkStay needs to be disabled. */
virtual ~cChunkStay();
/** Clears all the chunks that have been added.
To be used only while the ChunkStay object is not enabled. */
void Clear(void);
/** Adds a chunk to be locked from unloading.

View File

@ -286,6 +286,7 @@ void cLightingThread::LightChunk(cLightingChunkStay & a_Item)
{
a_Item.m_CallbackAfter->Call(a_Item.m_ChunkX, a_Item.m_ChunkZ);
}
a_Item.Disable();
delete &a_Item;
}