Salome HOME
Issue #2373: Fatal error when macros box after folder
authorazv <azv@opencascade.com>
Fri, 15 Dec 2017 11:36:42 +0000 (14:36 +0300)
committerazv <azv@opencascade.com>
Fri, 15 Dec 2017 11:36:42 +0000 (14:36 +0300)
Correct deleting feature which is placed in folder

src/Model/Model_Objects.cpp
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp

index 85a9f6dc2c3daefb5b3fa86e2ef818f41ea2a13b..6f5c45a21028ddcddb43da32d3c79264f78f7f14 100644 (file)
@@ -307,6 +307,8 @@ void Model_Objects::removeFeature(FeaturePtr theFeature)
         aComposite->removeFeature(theFeature);
       }
     }
+    // remove feature from folder
+    removeFromFolder(std::list<FeaturePtr>(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
index 16122052155c527b9c72a2177db06753c79a556c..830a482fed2eda7b2c61f1bafa6c99d2d6809f12 100644 (file)
@@ -150,7 +150,7 @@ static bool hasReference(std::shared_ptr<SketchPlugin_Feature> theFeature,
   for (std::set<AttributePtr>::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;