From: vsv Date: Mon, 25 Dec 2017 12:58:44 +0000 (+0300) Subject: Issue #2360: Clear current selection before change of selection type because it could... X-Git-Tag: V_2.10.1~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=756e01646844fa169efde2e4f81b26262f37431f;p=modules%2Fshaper.git Issue #2360: Clear current selection before change of selection type because it could cause crash because of obsolete index update in Object Browser --- diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 6f5c45a21..2dc014a40 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -593,8 +593,8 @@ ObjectPtr Model_Objects::object(const std::string& theGroupID, createHistory(theGroupID); const std::string& aGroupID = groupNameFoldering(theGroupID, theAllowFolder); const std::vector& 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]; } diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index de224116c..407a59339 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -435,6 +435,11 @@ QList 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 aEmptyList; + myWorkshop->setSelected(aEmptyList); + updateSelectionModesAndFilters(true); myWorkshop->selectionActivate()->updateSelectionModes();