From 4cdc6d4332cde1f7d1e37e0305f2c776ca2c30d0 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 2 Sep 2016 11:09:11 +0300 Subject: [PATCH] Fix for the issue #1712 : avoid duplicates and not-concealed attributes usage --- src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp index c39cbd4da..fd5c23cef 100644 --- a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp +++ b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include @@ -75,12 +77,19 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() myBaseFeature->data()->referencesToObjects(aRefs); std::list > >::const_iterator anIt = aRefs.begin(), aLast = aRefs.end(); + std::set alreadyThere; // to avoid duplications for (; anIt != aLast; anIt++) { + if (!ModelAPI_Session::get()->validators()-> + isConcealed(myBaseFeature->getKind(), anIt->first)) + continue; // use only concealed attributes std::list anObjects = (*anIt).second; std::list::const_iterator anOIt = anObjects.begin(), anOLast = anObjects.end(); for (; anOIt != anOLast; anOIt++) { ResultPtr aResult = std::dynamic_pointer_cast(*anOIt); if (aResult && aResult->isConcealed()) { + if (alreadyThere.find(aResult) == alreadyThere.end()) // issue 1712, avoid duplicates + alreadyThere.insert(aResult); + else continue; int aRowId = myView->rowCount(); addViewRow(aResult); myConcealedResults[aRowId] = aResult; -- 2.39.2