isFound = (aGrEntIter->find(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());
if (aConstrEnt[i] != 0) {
aNewGrEnt.insert(aConstrEnt[i]);
int aEntPos = Search(aConstrEnt[i], myEntities);
- Slvs_hEntity* aSub = myEntities[aEntPos].point;
- for (int j = 0; *aSub != 0 && j < 4; aSub++, j++)
- aNewGrEnt.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++)
+ aNewGrEnt.insert(*aSub);
+ }
}
std::set<Slvs_hConstraint> aNewGrConstr;
aNewGrConstr.insert(aConstrIter->h);
if (aConstrEnt[i] != 0) {
aGrEntIter->insert(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())
if (aDoc == aRootDoc) { // If root objects
if (aGroup == ModelAPI_ResultPart::group()) { // Update only Parts group
int aStart = myPartModels.size() - 1;
- removeSubModel(aStart);
- removeRow(aStart, partFolderNode());
- if (myActivePart && (!isPartSubModel(myActivePart))) {
- myActivePart = 0;
- myActivePartIndex = QModelIndex();
- myModel->setItemsColor(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);