From fda5b0fffdec693a3a0a8cc2b2c6bd593531d5e2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 10 Nov 2014 11:03:15 -0800 Subject: [PATCH] fix a bug produced by not setting deleted var to NULL --- libraries/octree/src/Octree.cpp | 5 +++-- libraries/voxels/src/VoxelTreeElement.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index ceda91a441..596dd7536c 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -547,11 +547,12 @@ void Octree::deleteOctalCodeFromTreeRecursion(OctreeElement* element, void* extr void Octree::eraseAllOctreeElements(bool createNewRoot) { delete _rootElement; // this will recurse and delete all children + _rootElement = NULL; + if (createNewRoot) { _rootElement = createNewElement(); - } else { - _rootElement = NULL; } + _isDirty = true; } diff --git a/libraries/voxels/src/VoxelTreeElement.h b/libraries/voxels/src/VoxelTreeElement.h index b1bff7dcc9..0ea91d4657 100644 --- a/libraries/voxels/src/VoxelTreeElement.h +++ b/libraries/voxels/src/VoxelTreeElement.h @@ -79,8 +79,8 @@ public: protected: - uint32_t _glBufferIndex : 24, /// Client only, vbo index for this voxel if being rendered, 3 bytes - _voxelSystemIndex : 8; /// Client only, index to the VoxelSystem rendering this voxel, 1 bytes + uint32_t _glBufferIndex : 24; /// Client only, vbo index for this voxel if being rendered, 3 bytes + uint32_t _voxelSystemIndex : 8; /// Client only, index to the VoxelSystem rendering this voxel, 1 bytes // Support for _voxelSystemIndex, we use these static member variables to track the VoxelSystems that are // in use by various voxel nodes. We map the VoxelSystem pointers into an 1 byte key, this limits us to at