From f0cfc282531e9a07769b252fff20ca4c89e7f408 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 15 Dec 2017 14:36:42 +0300 Subject: [PATCH] Issue #2373: Fatal error when macros box after folder Correct deleting feature which is placed in folder --- src/Model/Model_Objects.cpp | 2 ++ src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 85a9f6dc2..6f5c45a21 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -307,6 +307,8 @@ void Model_Objects::removeFeature(FeaturePtr theFeature) aComposite->removeFeature(theFeature); } } + // remove feature from folder + removeFromFolder(std::list(1, theFeature)); // this must be before erase since theFeature erasing removes all information about // the feature results and groups of results // To reproduce: create sketch, extrusion, remove sketch => constructions tree is not updated diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp index 161220521..830a482fe 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp @@ -150,7 +150,7 @@ static bool hasReference(std::shared_ptr theFeature, for (std::set::const_iterator aRefIt = aRefs.begin(); aRefIt != aRefs.end(); ++aRefIt) { FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); - if (anOwner->getKind() == theFeatureKind) + if (anOwner && anOwner->getKind() == theFeatureKind) return true; } return false; -- 2.39.2