From c2b3996d2be58d506ca894e56115535769564f89 Mon Sep 17 00:00:00 2001 From: Manuel Massing Date: Wed, 5 Feb 2014 10:36:47 +0100 Subject: [PATCH] Make sure vertex error is evaluated before add_vertex_in_edge is called. vertex_in_edge deletes the passed in edge handle (q_edges[m]), so it must not be accessed after the split. --- src/voronoidiagram.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/voronoidiagram.cpp b/src/voronoidiagram.cpp index c751d59a..2f855d19 100644 --- a/src/voronoidiagram.cpp +++ b/src/voronoidiagram.cpp @@ -1517,7 +1517,6 @@ void VoronoiDiagram::add_vertices( Site* new_site ) { } HEVertex q = g.add_vertex( VoronoiVertex( sl.p, NEW, NORMAL, new_site->apex_point( sl.p ), sl.k3 ) ); modified_vertices.insert(q); - g.add_vertex_in_edge( q, q_edges[m] ); g[q].max_error = vpos->dist_error( q_edges[m], sl, new_site); if (debug) { HEVertex src = g.source(q_edges[m]); @@ -1525,6 +1524,7 @@ void VoronoiDiagram::add_vertices( Site* new_site ) { std::cout << " NEW vertex " << g[q].index << " k3= "<< g[q].k3 << " on edge " << g[src].index << " - " << g[trg].index << "\n"; assert( (g[q].k3==1) || (g[q].k3==-1) ); } + g.add_vertex_in_edge( q, q_edges[m] ); } if (debug) std::cout << "add_vertices() done.\n"; }