]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix bug with deletion of sub-nodes
authorvsv <vsv@opencascade.com>
Thu, 1 Nov 2018 10:14:25 +0000 (13:14 +0300)
committervsv <vsv@opencascade.com>
Thu, 1 Nov 2018 10:14:25 +0000 (13:14 +0300)
src/PartSet/PartSet_TreeNodes.cpp
src/XGUI/XGUI_DataModel.cpp

index a2bc7be624e6a76f2677355c102beabf2870c215..aa2394aaa7024e1b457228c1aad65c4dacf49c55 100644 (file)
@@ -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;
index 92a4bc67ce6d7e5293dfb66e5781bcb1c580b14b..95c80678b3bbe3b9597dd6ba0a167b2152b086f7 100644 (file)
@@ -100,7 +100,14 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& 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();
     }