From: mpv Date: Mon, 20 Jul 2020 12:59:41 +0000 (+0300) Subject: Fix for #19754: EDF 21721 - Problems with a study X-Git-Tag: V9_6_0a1~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c89ffdcaa9e7f83bc093572698a45abd6a66e16;p=modules%2Fshaper.git Fix for #19754: EDF 21721 - Problems with a study Fixed crashes on dumping to python if there are problems with features validity. Improved the error-status appearance when previous features are dramatically changed. --- diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index cf817b651..21e27c869 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -303,8 +303,8 @@ TNaming_Builder* Model_BodyBuilder::builder(const int theTag) std::map::iterator aFind = myBuilders.find(theTag); if (aFind == myBuilders.end()) { std::shared_ptr aData = std::dynamic_pointer_cast(data()); - myBuilders[theTag] = new TNaming_Builder( - theTag == 0 ? aData->shapeLab() : aData->shapeLab().FindChild(theTag)); + TDF_Label aLab = theTag == 0 ? aData->shapeLab() : aData->shapeLab().FindChild(theTag); + myBuilders[theTag] = new TNaming_Builder(aLab); aFind = myBuilders.find(theTag); } return aFind->second; @@ -431,6 +431,11 @@ void Model_BodyBuilder::clean() for(; anEntriesIter.More(); anEntriesIter.Next()) { anEntriesIter.Value()->Label().ForgetAttribute(kEXTERNAL_SHAPE_REF); } + // to clear old shapes in all sub-labels (they may be left without builders on Open) + TDF_ChildIDIterator aNSIter(aLab, TNaming_NamedShape::GetID(), true); + for(; aNSIter.More(); aNSIter.Next()) { + aNSIter.Value()->Label().ForgetAttribute(aNSIter.Value()); + } } void Model_BodyBuilder::cleanCash() diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 2f87922c2..e3b007bb8 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -698,7 +698,7 @@ std::pair getDefaultName(const std::shared_ptrgroupName() == ModelAPI_ResultBody::group()) { + if (anObjIt->get() && (*anObjIt)->groupName() == ModelAPI_ResultBody::group()) { // check the result is part of CompSolid ResultPtr anObjRes = std::dynamic_pointer_cast(*anObjIt); ResultBodyPtr aParentBody = ModelAPI_Tools::bodyOwner(anObjRes); diff --git a/src/Selector/Selector_FilterByNeighbors.cpp b/src/Selector/Selector_FilterByNeighbors.cpp index 49992956b..57e38acad 100644 --- a/src/Selector/Selector_FilterByNeighbors.cpp +++ b/src/Selector/Selector_FilterByNeighbors.cpp @@ -402,6 +402,8 @@ std::wstring Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGen if (!*aSubSel) continue; std::wstring aSubName = (*aSubSel)->name(theNameGenerator); + if (aSubName.empty()) + return L"()"; aResult += L"(" + aSubName + L")"; if (*aLevel > 1) { std::wostringstream aLevelStr;