From 9be93bf2617cd8084077fce22912f1c28fba7b24 Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 29 May 2018 14:52:09 +0300 Subject: [PATCH] Fix crash on redoing IntersectionPoint --- .../SketchPlugin_IntersectionPoint.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp index e4feff995..be389af74 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp @@ -105,25 +105,28 @@ void SketchPlugin_IntersectionPoint::computePoint(const std::string& theID) for (std::list::iterator aPntIt = anIntersectionsPoints.begin(); aPntIt != anIntersectionsPoints.end(); ++aPntIt, ++aResultIndex) { std::shared_ptr aCurSketchPoint; - ResultConstructionPtr aCurResult; if (aExistInterIt == anExistentIntersections.end()) { - // create new point and result + // create new point aCurSketchPoint = std::dynamic_pointer_cast( sketch()->addFeature(SketchPlugin_Point::ID())); aCurSketchPoint->boolean(COPY_ID())->setValue(true); anIntersectionsList->append(aCurSketchPoint); + } else { + // update existent point + aCurSketchPoint = std::dynamic_pointer_cast(*aExistInterIt); + ++aExistInterIt; + } + ResultConstructionPtr aCurResult; + if (aResIt == aResults.end()) { + // create new result aCurResult = document()->createConstruction(data(), aResultIndex); aCurResult->setIsInHistory(false); aCurResult->setDisplayed(false); - } - else { - // update existent result point - aCurSketchPoint = std::dynamic_pointer_cast(*aExistInterIt); + } else { + // update existent result aCurResult = std::dynamic_pointer_cast(*aResIt); aCurResult->setShape(std::shared_ptr()); - - ++aExistInterIt; ++aResIt; } -- 2.39.2