]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the TestParameterRename.py crash sometimes on Linux: map removes shared point...
authormpv <mpv@opencascade.com>
Mon, 10 Aug 2015 11:32:46 +0000 (14:32 +0300)
committermpv <mpv@opencascade.com>
Mon, 10 Aug 2015 11:32:46 +0000 (14:32 +0300)
src/Model/Model_Objects.cpp

index 9e4e270ac0e02706ae5e4bf060bc5792f1e13dcf..9c7a4eafaa6fa3cc08fd6a38460df7a7375908d9 100644 (file)
@@ -59,16 +59,17 @@ Model_Objects::~Model_Objects()
 {
   // delete all features of this document
   Events_Loop* aLoop = Events_Loop::loop();
-  NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFeaturesIter(myFeatures);
-  for(; aFeaturesIter.More(); aFeaturesIter.Next()) {
+  // erase one by one to avoid access from the feature destructor itself from he map
+  while(!myFeatures.IsEmpty()) {
+    NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFeaturesIter(myFeatures);
     FeaturePtr aFeature = aFeaturesIter.Value();
     static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
     ModelAPI_EventCreator::get()->sendDeleted(myDoc, ModelAPI_Feature::group());
     ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP);
     aFeature->eraseResults();
     aFeature->erase();
+    myFeatures.UnBind(aFeaturesIter.Key());
   }
-  myFeatures.Clear();
   aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
   aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));