diff --git a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h index e13471ce036..5f357c809ab 100644 --- a/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h +++ b/Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation/internal/auxiliary/graph.h @@ -520,6 +520,8 @@ public: /* Destructor */ ~Graph(); + void clear(); + /* Adds a node to the graph */ node_id add_node(); @@ -701,7 +703,7 @@ inline Graph::Graph(void (*err_function)(const char *)) flow = 0; } -inline Graph::~Graph() +inline void Graph::clear() { while (node_block_first) { node_block *next = node_block_first -> next; @@ -722,6 +724,11 @@ inline Graph::~Graph() } } +inline Graph::~Graph() +{ + clear(); +} + inline Graph::node_id Graph::add_node() { node *i; diff --git a/Surface_mesh_segmentation/include/CGAL/boost/graph/Alpha_expansion_MaxFlow_tag.h b/Surface_mesh_segmentation/include/CGAL/boost/graph/Alpha_expansion_MaxFlow_tag.h index 3b311b70191..7ef35e755d6 100644 --- a/Surface_mesh_segmentation/include/CGAL/boost/graph/Alpha_expansion_MaxFlow_tag.h +++ b/Surface_mesh_segmentation/include/CGAL/boost/graph/Alpha_expansion_MaxFlow_tag.h @@ -47,7 +47,7 @@ public: void clear_graph() { - graph = MaxFlow::Graph(); + graph.clear(); } Vertex_descriptor add_vertex()