From: mpv Date: Thu, 13 Nov 2014 11:16:01 +0000 (+0300) Subject: Fix for crashes on close of application in SALOME mode X-Git-Tag: V_0.5.1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=75f7ccfa986b5269cb436c828016bd6a8f3b98e1;p=modules%2Fshaper.git Fix for crashes on close of application in SALOME mode --- diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index d0e1d96ac..2eb18737c 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -975,9 +975,11 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vectorfind(aConstrEnt[i]) != aGrEntIter->end()); // Also we need to check sub-entities int aEntPos = Search(aConstrEnt[i], myEntities); - Slvs_hEntity* aSub = myEntities[aEntPos].point; - for (int j = 0; *aSub != 0 && j < 4 && !isFound; aSub++, j++) - isFound = (aGrEntIter->find(*aSub) != aGrEntIter->end()); + if (aEntPos != myEntities.size()) { // MPV: to fix the crash on close + Slvs_hEntity* aSub = myEntities[aEntPos].point; + for (int j = 0; *aSub != 0 && j < 4 && !isFound; aSub++, j++) + isFound = (aGrEntIter->find(*aSub) != aGrEntIter->end()); + } } if (isFound) anIndexes.push_back(aGrEntIter - aGroupsEntities.begin()); @@ -989,9 +991,11 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector aNewGrConstr; aNewGrConstr.insert(aConstrIter->h); @@ -1006,9 +1010,11 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vectorinsert(aConstrEnt[i]); int aEntPos = Search(aConstrEnt[i], myEntities); - Slvs_hEntity* aSub = myEntities[aEntPos].point; - for (int j = 0; *aSub != 0 && j < 4; aSub++, j++) - aGrEntIter->insert(*aSub); + if (aEntPos != myEntities.size()) { // MPV: to fix the crash on close + Slvs_hEntity* aSub = myEntities[aEntPos].point; + for (int j = 0; *aSub != 0 && j < 4; aSub++, j++) + aGrEntIter->insert(*aSub); + } } aGroupsConstr[anIndexes.front()].insert(aConstrIter->h); if (aGrEntIter->size() > aGroupsEntities[aMaxNbEntities].size()) diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index 14a8735b1..42d96c8be 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -108,12 +108,14 @@ void XGUI_DocumentDataModel::processEvent(const boost::shared_ptrsetItemsColor(ACTIVE_COLOR); + if (aStart >= 0) {// MPV: this could be reproduced on close + removeSubModel(aStart); + removeRow(aStart, partFolderNode()); + if (myActivePart && (!isPartSubModel(myActivePart))) { + myActivePart = 0; + myActivePartIndex = QModelIndex(); + myModel->setItemsColor(ACTIVE_COLOR); + } } } else { // Update top groups (other except parts QModelIndex aIndex = myModel->findGroup(aGroup);