Salome HOME
Issue #2612 : Re-calculate model after modification of parameters
[modules/shaper.git] / src / Model / Model_ResultBody.cpp
index e22a0f38e26e62c0c7bb96e078255bed22b150a1..c68a4ae4b54f2107f56759a0fa7c5bcfbc99ed29 100644 (file)
@@ -77,11 +77,12 @@ void Model_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
       }*/
       (*aSubIter)->loadAndOrientModifiedShapes(
         theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
-        theIsStoreAsGenerated);
+        theIsStoreAsGenerated, theSplitInSubs);
     }
   } else { // do for this directly
-    myBuilder->loadAndOrientGeneratedShapes(
-      theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
+    myBuilder->loadAndOrientModifiedShapes(
+      theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
+        theIsStoreAsGenerated);
   }
 }
 
@@ -92,6 +93,8 @@ int Model_ResultBody::numberOfSubs(bool forTree) const
 
 ResultBodyPtr Model_ResultBody::subResult(const int theIndex, bool forTree) const
 {
+  if (theIndex >= int(mySubs.size()))
+    return ResultBodyPtr();
   return mySubs.at(theIndex);
 }
 
@@ -158,6 +161,8 @@ void Model_ResultBody::updateConcealment()
   if (myLastConcealed != ModelAPI_ResultBody::isConcealed()) {
     // check the whole tree of results: if one is concealed, everybody are concealed
     ResultBodyPtr anOwner = std::dynamic_pointer_cast<ModelAPI_ResultBody>(data()->owner());
+    if (!anOwner.get())
+      return; // "this" is invalid
     ResultBodyPtr aParent = ModelAPI_Tools::bodyOwner(anOwner);
     while(aParent.get()) {
       anOwner = aParent;