diff --git a/Src/Containers/FSubOctree.hpp b/Src/Containers/FSubOctree.hpp index 07e92fc61f1c5c8de8fd53654c4da1ac2876615b..fecf26afe900c83036b264f86f879324bae82b5a 100755 --- a/Src/Containers/FSubOctree.hpp +++ b/Src/Containers/FSubOctree.hpp @@ -51,7 +51,7 @@ template< class CellClass , class ContainerClass, class LeafClass, class CellAll class FAbstractSubOctree { protected: - CellClass*** cells; //< Potential cells, cells are allocated only if needed + CellClass*** cells; //< Potential cells, cells are allocated only if needed FAbstractSubOctree* const parent; //< Parent suboctree (null for root) const int indexInParent; //< This is the index of the current octree in the parent's array @@ -60,7 +60,7 @@ protected: int rightLeafIndex; //< The leaf at the right position (this is the last array index when iterate) const int subOctreeHeight; //< Height of this suboctree - const int subOctreePosition; //< Level of the current suboctree in the global tree (0 if node) + const int subOctreePosition; //< Level of the current suboctree in the global tree (0 if node) const bool isLeafSubtree; //< To know if a subtree is leaf or not (we prefere that to a virtual method) @@ -135,8 +135,12 @@ protected: // Manage border limits if(arrayIndex == this->leftLeafIndex && arrayIndex == this->rightLeafIndex){ - this->rightLeafIndex = -1; + this->rightLeafIndex = -1; // only one cells, return true + // remove the last cells + cellAllocator.deleteObject(this->cells[indexLevel][arrayIndex]); + this->cells[indexLevel][arrayIndex] =nullptr; + return true; } else if(arrayIndex == this->leftLeafIndex){ @@ -631,4 +635,3 @@ public: #endif //FSUBOCTREE_HPP -