From e8fca89a2c894164fc3800714eae00b3bc895231 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Fri, 19 Jun 2015 19:39:33 +0200 Subject: [PATCH] fix dereference of a deleted pointer --- common/geometry/shape_poly_set.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp index fdf43f457e..5bebf6faec 100644 --- a/common/geometry/shape_poly_set.cpp +++ b/common/geometry/shape_poly_set.cpp @@ -447,16 +447,19 @@ void SHAPE_POLY_SET::fractureSingle( ClipperLib::Paths& paths ) paths.clear(); Path newPath; newPath.push_back(prev); - FractureEdge *e; + FractureEdge *e, *e_next; IntPoint p; - for( e = root; e->m_next != root; e=e->m_next) - { + e = root; + + do { p = e->m_p1; newPath.push_back(p); prev = p; + e_next = e->m_next; delete e; - } + e = e_next; + } while(e->m_next != root); p = e->m_p1;