Bugfix: used invalid iterator in boundaries_of_same_face predicate

This commit is contained in:
Eric Berberich 2007-09-03 07:26:54 +00:00
parent f172442a82
commit 596e804f8f
1 changed files with 13 additions and 4 deletions

View File

@ -2844,10 +2844,10 @@ Arrangement_on_surface_2<GeomTraits, TopTraits>::_insert_at_vertices
// Go over all other outer CCBs of f and check whether they should be // Go over all other outer CCBs of f and check whether they should be
// moved to be outer CCBs of the new face. // moved to be outer CCBs of the new face.
DOuter_ccb_iter oc_it; DOuter_ccb_iter oc_it = f->outer_ccbs_begin();
DOuter_ccb_iter oc_to_move;
for (oc_it = f->outer_ccbs_begin(); while (oc_it != f->outer_ccbs_end())
oc_it != f->outer_ccbs_end(); ++oc_it)
{ {
// Use the topology traits to determine whether the representative // Use the topology traits to determine whether the representative
// of the current outer CCB should belong to the same face as he2 // of the current outer CCB should belong to the same face as he2
@ -2855,7 +2855,16 @@ Arrangement_on_surface_2<GeomTraits, TopTraits>::_insert_at_vertices
if (*oc_it != he1 && if (*oc_it != he1 &&
top_traits.boundaries_of_same_face (*oc_it, he2)) top_traits.boundaries_of_same_face (*oc_it, he2))
{ {
_move_outer_ccb (f, new_f, *oc_it); // We increment the itrator before moving the outer CCB, because
// this operation invalidates the iterator.
oc_to_move = oc_it;
++oc_it;
_move_outer_ccb (f, new_f, *oc_to_move);
}
else
{
++oc_it;
} }
} }
} }