Salome HOME
Merge branch 'csgroup_IS2'
[modules/shaper.git] / src / ModelAPI / ModelAPI_Feature.cpp
index 6eacd88767ff741bde1d1766ab8487f852cb14ac..14397b0fea7efed0e0c42ee1af67e89196f375c8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -156,10 +156,6 @@ void ModelAPI_Feature::erase()
     document()->setCurrentFeatureUp();
   }
 
-  static Events_Loop* aLoop = Events_Loop::loop();
-  static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
-  static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
-
   while (!myResults.empty()) {  // remove one by one with messages
     std::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
     aRes->setDisabled(aRes, true); // to avoid activation of the Part result
@@ -208,11 +204,13 @@ bool ModelAPI_Feature::setDisabled(const bool theFlag)
         (*aResIter)->setDisabled(*aResIter, false);
       }
       // update selection for the case something was updated higher in the history
-      // while this feature was disabled
+      // while this feature was disabled, but avoid flushing it immediately and
+      // wait while all the previous features update myIsDisabled flag
+      // (flush will be called by the document)
       static Events_Loop* aLoop = Events_Loop::loop();
       static Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION);
       static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
-      aECreator->sendUpdated(data()->owner(), kUpdatedSel, false);
+      aECreator->sendUpdated(data()->owner(), kUpdatedSel, true);
     }
     return true;
   }
@@ -245,7 +243,7 @@ bool ModelAPI_Feature::isStable()
   return myIsStable;
 }
 
-bool ModelAPI_Feature::customAction(const std::string& theActionId)
+bool ModelAPI_Feature::customAction(const std::string& /*theActionId*/)
 {
   return false;
 }