From: vsv Date: Thu, 1 Nov 2018 10:14:25 +0000 (+0300) Subject: Fix bug with deletion of sub-nodes X-Git-Tag: End2018~217 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f7b5c6a37b21ed5155cafde276f75056e90f1ca1;p=modules%2Fshaper.git Fix bug with deletion of sub-nodes --- diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index a2bc7be62..aa2394aaa 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -368,7 +368,6 @@ QTreeNodesList PartSet_ObjectNode::objectsDeleted( aObj = subObject(aId); if (aNode->object() != aObj) { myChildren.removeAll(aNode); - aResult.removeAll(aNode); delete aNode; isDeleted = true; } @@ -602,7 +601,6 @@ QTreeNodesList PartSet_FolderNode::objectsDeleted(const DocumentPtr& theDoc, aToSort |= ((aIndex != -1) && (aId != aIndex)); if (aIndex == -1) { myChildren.removeAll(aNode); - aResult.removeAll(aNode); delete aNode; aRemoved = true; } @@ -699,7 +697,6 @@ QTreeNodesList PartSet_FeatureFolderNode::objectsDeleted(const DocumentPtr& theD aToSort |= ((aIndex != -1) && (aId != (aIndex + aNb))); if (aIndex == -1) { myChildren.removeAll(aNode); - aResult.removeAll(aNode); delete aNode; aRemoved = true; continue; @@ -1143,7 +1140,6 @@ QTreeNodesList PartSet_ObjectFolderNode::objectsDeleted(const DocumentPtr& theDo if ((aFirst + aId) < aNbOfFeatures) { if (aNode->object() != aDoc->object(ModelAPI_Feature::group(), aFirst + aId)) { myChildren.removeAll(aNode); - aResult.removeAll(aNode); delete aNode; aRemoved = true; continue; diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 92a4bc67c..95c80678b 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -100,7 +100,14 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) { aList.append(myRoot->objectsDeleted(aIt->first, aIt->second.c_str())); } + // Remove obsolete nodes + QTreeNodesList aRemaining; foreach(ModuleBase_ITreeNode* aNode, aList) { + if (myRoot->hasSubNode(aNode)) + aRemaining.append(aNode); + } + // Update remaining nodes + foreach(ModuleBase_ITreeNode* aNode, aRemaining) { if (aNode->parent()) aNode->parent()->update(); }