Salome HOME
Fix for the issue #937 and crashes:
[modules/shaper.git] / src / Model / Model_Update.cpp
index 4b4ac45a22a937e84424f373e8627ff58795c573..93205e353fbcb3c23a4b50db0c7326f1256e6acc 100644 (file)
@@ -202,7 +202,7 @@ void Model_Update::iterateUpdateBreak(std::shared_ptr<ModelAPI_Feature> theFeatu
         }
         // for the current breaked, set iteration to this feature precisely
         aBreaked->setCurrentBefore(theFeature);
-        myModification++;
+        //myModification++;
       }
       // the iterator that contains breaked is found, so, nothing else is needed
       return;
@@ -275,7 +275,7 @@ void Model_Update::updateFeature(FeaturePtr theFeature)
     return;
 
   #ifdef DEB_UPDATE
-    //std::cout<<"Update Feature "<<theFeature->name()<<std::endl;
+    std::cout<<"Update Feature "<<theFeature->name()<<std::endl;
   #endif
   CompositeFeaturePtr aCompos = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
   // If automatice update is not needed and feature attributes were not updated right now,
@@ -356,6 +356,9 @@ void Model_Update::updateFeature(FeaturePtr theFeature)
         #endif
         executeFeature(theFeature);
       } else {
+        #ifdef DEB_UPDATE
+          std::cout<<"Feature is not valid, erase results "<<theFeature->name()<<std::endl;
+        #endif
         theFeature->eraseResults();
         redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
       }
@@ -680,7 +683,14 @@ void Model_Update::IterationItem::next()
           break;
       }
     } else if (mySub.get()) {
-      mySub = myObjects->nextFeature(mySub);
+      while(mySub.get()) {
+        mySub = myObjects->nextFeature(mySub);
+        CompositeFeaturePtr anOwner = ModelAPI_Tools::compositeOwner(mySub);
+        // skip sub-objects, that are subs not only for this: sketch elements relatively to PartSet
+        if (!anOwner.get()) {
+          break;
+        }
+      }
     }
   }
 }