From d412630904c1de6c0d9ef00fbc75b5558f931e8b Mon Sep 17 00:00:00 2001 From: Tycho Date: Sun, 27 Apr 2014 08:11:56 -0700 Subject: Fixed a couple of segfaults and made Free a seperate function --- src/ChunkBuffer.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ChunkBuffer.h') diff --git a/src/ChunkBuffer.h b/src/ChunkBuffer.h index a6a6da013..c23f8971d 100644 --- a/src/ChunkBuffer.h +++ b/src/ChunkBuffer.h @@ -30,7 +30,7 @@ public: #endif for (int i = 0; i < CHUNK_SECTION_NUM; i++) { - if(m_Sections[i]) delete m_Sections[i]; + if(m_Sections[i]) Free(m_Sections[i]);; } } @@ -52,7 +52,7 @@ public: { for (int i = 0; i < CHUNK_SECTION_NUM; i++) { - if(m_Sections[i]) delete m_Sections[i]; + if(m_Sections[i]) Free(m_Sections[i]);; } } IsOwner = true; @@ -76,7 +76,7 @@ public: { for (int i = 0; i < CHUNK_SECTION_NUM; i++) { - if(m_Sections[i]) delete m_Sections[i]; + if(m_Sections[i]) Free(m_Sections[i]);; m_Sections[i] = other.m_Sections[i]; } } @@ -239,6 +239,7 @@ private: sChunkSection *m_Sections[CHUNK_SECTION_NUM]; sChunkSection * Allocate() const; + void Free(sChunkSection * ptr) const; }; -- cgit v1.2.3