From 87e6f7722c2b4004984f084b321405538eeba641 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 11 Apr 2016 16:38:48 +0300 Subject: [PATCH] Fix for unit tests --- src/Model/Model_Data.cpp | 8 +++++++- src/Model/Model_Objects.cpp | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) 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 -- 2.39.2