Salome HOME
Issue #3172: Valid partition is invalid after save/open saved document
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.cpp
index fae06823576e8d7bac17d965705f6761dfea4a49..bab6ca0029ab230033e73bc315756249009c52b9 100644 (file)
@@ -937,13 +937,15 @@ bool ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects
     AttributeSelectionListPtr aSelectionListAttr = aData->selectionList(attributeID());
     for (int i = 0; i < aSelectionListAttr->size(); i++) {
       AttributeSelectionPtr anAttr = aSelectionListAttr->value(i);
-      //aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->contextObject());
-      //if (!aFeature.get()) { // Feature can not be found as geometry selection
-        bool aFound = findInSelection(
-          anAttr->contextObject(), anAttr->value(), aGeomSelection, myWorkshop);
-        if (!aFound)
-          anIndicesToBeRemoved.insert(i);
-//      }
+      ObjectPtr aContextObject = anAttr->contextObject();
+      GeomShapePtr aShape;
+      aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aContextObject);
+      if (!aFeature.get())
+        aShape = anAttr->value();
+
+      bool aFound = findInSelection(aContextObject, aShape, aGeomSelection, myWorkshop);
+      if (!aFound)
+        anIndicesToBeRemoved.insert(i);
     }
     isDone = anIndicesToBeRemoved.size() > 0;
     if (isDone)