Salome HOME
Merge branch 'Dev_1.3.0' of newgeom:newgeom into Dev_1.3.0
authormpv <mpv@opencascade.com>
Tue, 30 Jun 2015 11:49:06 +0000 (14:49 +0300)
committermpv <mpv@opencascade.com>
Tue, 30 Jun 2015 11:49:06 +0000 (14:49 +0300)
src/Model/Model_Update.cpp

index 5aa0e18f78011bec544c9dc047800a4abb813457..1572d8f3a3671f876eeecf35ef0130cbd110351a 100644 (file)
@@ -114,7 +114,7 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
   if (isOperationChanged) {
     // remove all macros before clearing all created and execute all not-previewed
     std::set<ObjectPtr>::iterator anUpdatedIter = myJustUpdated.begin();
-    for(; anUpdatedIter != myJustUpdated.end(); anUpdatedIter++) {
+    while(anUpdatedIter != myJustUpdated.end()) {
       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anUpdatedIter);
       if (aFeature.get()) {
         // execute not-previewed feature on "apply"
@@ -126,8 +126,14 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
         }
         // remove macro on apply
         if (aFeature->isMacro()) {
+          myJustUpdated.erase(aFeature); // to avoid the map update problems on "remove"
           aFeature->document()->removeFeature(aFeature);
+          anUpdatedIter = myJustUpdated.begin();
+        } else {
+          anUpdatedIter++;
         }
+      } else {
+        anUpdatedIter++;
       }
     }
     myIsParamUpdated = false;