From: mpv Date: Mon, 11 Apr 2016 13:38:48 +0000 (+0300) Subject: Fix for unit tests X-Git-Tag: V_2.3.0~247 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=87e6f7722c2b4004984f084b321405538eeba641;p=modules%2Fshaper.git Fix for unit tests --- diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index c907ea63f..f292ccc75 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -536,7 +536,13 @@ void Model_Data::referencesToObjects( } else if (aType == ModelAPI_AttributeRefAttr::typeId()) { // reference to attribute or object std::shared_ptr aRef = std::dynamic_pointer_cast< ModelAPI_AttributeRefAttr>(anAttr->second); - aReferenced.push_back(aRef->isObject() ? aRef->object() : aRef->attr()->owner()); + if (aRef->isObject()) { + aReferenced.push_back(aRef->object()); + } else { + AttributePtr anAttr = aRef->attr(); + if (anAttr.get()) + aReferenced.push_back(anAttr->owner()); + } } else if (aType == ModelAPI_AttributeRefList::typeId()) { // list of references aReferenced = std::dynamic_pointer_cast(anAttr->second)->list(); } else if (aType == ModelAPI_AttributeSelection::typeId()) { // selection attribute diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 11365789d..d421d2161 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -691,7 +691,9 @@ void Model_Objects::synchronizeFeatures( // redisplay also removed feature (used for sketch and AISObject) ModelAPI_EventCreator::get()->sendUpdated(aFeature, aRedispEvent); updateHistory(aFeature); - aFeature->erase(); + // don't call this because it will ask the internal attributes + //aFeature->erase(); + // unbind after the "erase" call: on abort sketch is removes sub-objects that corrupts aFIter myFeatures.UnBind(aFIter.Key()); // reinitialize iterator because unbind may corrupt the previous order in the map