From d1eca8310f955652616b3e1abdaa77f646ae004a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 7 Nov 2022 17:34:54 +0000 Subject: [PATCH 1/2] typo --- Orthtree/include/CGAL/Orthtree/Node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orthtree/include/CGAL/Orthtree/Node.h b/Orthtree/include/CGAL/Orthtree/Node.h index 5a485adcae8..219959b81cc 100644 --- a/Orthtree/include/CGAL/Orthtree/Node.h +++ b/Orthtree/include/CGAL/Orthtree/Node.h @@ -345,7 +345,7 @@ public: } /*! - \brief returns the nth child fo this node. + \brief returns the nth child of this node. \pre `!is_null()` \pre `!is_leaf()` From 331ea2898a896b3a6b1c3cd4966f88c1b7221d41 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 8 Nov 2022 15:15:20 +0000 Subject: [PATCH 2/2] Orthtree: Fix memory leak --- Orthtree/include/CGAL/Orthtree.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index 5c8cc3ca021..8091001a32f 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -320,8 +320,21 @@ public: void refine(const Split_predicate& split_predicate) { // If the tree has already been refined, reset it - if (!m_root.is_leaf()) + if (!m_root.is_leaf()){ + std::queue nodes; + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (m_root[i]); + while (!nodes.empty()) + { + Node node = nodes.front(); + nodes.pop(); + if (!node.is_leaf()) + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (node[i]); + node.free(); + } m_root.unsplit(); + } // Reset the side length map, too m_side_per_depth.resize(1);