]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2360: Clear current selection before change of selection type because it could...
authorvsv <vsv@opencascade.com>
Mon, 25 Dec 2017 12:58:44 +0000 (15:58 +0300)
committervsv <vsv@opencascade.com>
Mon, 25 Dec 2017 12:59:07 +0000 (15:59 +0300)
src/Model/Model_Objects.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp

index 6f5c45a21028ddcddb43da32d3c79264f78f7f14..2dc014a406498d6077eb29483cb308e9ff457e3c 100644 (file)
@@ -593,8 +593,8 @@ ObjectPtr Model_Objects::object(const std::string& theGroupID,
   createHistory(theGroupID);
   const std::string& aGroupID = groupNameFoldering(theGroupID, theAllowFolder);
   const std::vector<ObjectPtr>& aVec = myHistory[theGroupID];
-  if (aVec.size() <= theIndex)
-    return aVec[aVec.size() - 1]; // too high index requested (to avoid crash in #2360)
+  //if (aVec.size() <= theIndex)
+  //  return aVec[aVec.size() - 1]; // too high index requested (to avoid crash in #2360)
   return aGroupID.empty() ? myHistory[theGroupID][theIndex] : myHistory[aGroupID][theIndex];
 }
 
index de224116ca7a132508a28ba0409bf51386f86631..407a59339fe4b113e0c82ffd3e327636adbca5b2 100755 (executable)
@@ -435,6 +435,11 @@ QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
 //********************************************************************
 void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
 {
+  // Clear current selection in order to avoid updating of object browser with obsolete indexes
+  // which can appear because of results deletetion after changing a type of selection
+  QList<ModuleBase_ViewerPrsPtr> aEmptyList;
+  myWorkshop->setSelected(aEmptyList);
+
   updateSelectionModesAndFilters(true);
   myWorkshop->selectionActivate()->updateSelectionModes();