From: mpv Date: Mon, 10 Aug 2015 11:32:46 +0000 (+0300) Subject: Fix for the TestParameterRename.py crash sometimes on Linux: map removes shared point... X-Git-Tag: V_1.4.0_beta4~417 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=280ea8bb86dacc34aa86012472ec69b7cff04964;p=modules%2Fshaper.git Fix for the TestParameterRename.py crash sometimes on Linux: map removes shared pointer and destructor call the map with the same key that causes the infinitive recursion. --- diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 9e4e270ac..9c7a4eafa 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -59,16 +59,17 @@ Model_Objects::~Model_Objects() { // delete all features of this document Events_Loop* aLoop = Events_Loop::loop(); - NCollection_DataMap::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::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));