Skip to content

Commit 34cf058

Browse files
committed
ChunkStay must be disabled while being deleted.
Fixes #758.
1 parent 75b7244 commit 34cf058

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/ChunkStay.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ cChunkStay::~cChunkStay()
3131

3232
void cChunkStay::Clear(void)
3333
{
34-
if (m_ChunkMap != NULL)
35-
{
36-
Disable();
37-
}
34+
ASSERT(m_ChunkMap == NULL);
3835
m_Chunks.clear();
3936
}
4037

src/ChunkStay.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ class cChunkStay
3636
{
3737
public:
3838
cChunkStay(void);
39+
40+
/** Deletes the object. Note that this calls Clear(), which means that the ChunkStay needs to be disabled. */
3941
virtual ~cChunkStay();
4042

43+
/** Clears all the chunks that have been added.
44+
To be used only while the ChunkStay object is not enabled. */
4145
void Clear(void);
4246

4347
/** Adds a chunk to be locked from unloading.

src/LightingThread.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ void cLightingThread::LightChunk(cLightingChunkStay & a_Item)
286286
{
287287
a_Item.m_CallbackAfter->Call(a_Item.m_ChunkX, a_Item.m_ChunkZ);
288288
}
289+
a_Item.Disable();
289290
delete &a_Item;
290291
}
291292

0 commit comments

Comments
 (0)