]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2630: Prevent cycling of children nodes sorting.
authorvsv <vsv@opencascade.com>
Fri, 7 Sep 2018 15:30:17 +0000 (18:30 +0300)
committervsv <vsv@opencascade.com>
Fri, 7 Sep 2018 15:30:17 +0000 (18:30 +0300)
src/ModuleBase/ModuleBase_ITreeNode.h

index fcd6c7bd46b2560519cb26c0a7ad81a60820c990..77d1d2a46fa6fb71b35ba5e52669f9eab5c59198 100644 (file)
@@ -178,23 +178,25 @@ protected:
   }
 
   void sortChildren() {
-    int i = 0;
-    ModuleBase_ITreeNode* aNode = 0;
-    ObjectPtr aObject;
-    int aIdx;
-    while (i < myChildren.size()) {
-      aNode = myChildren.at(i);
-      aObject = aNode->object();
-      if (aObject.get()) {
-        aIdx = aObject->document()->index(aObject, true);
-        if (aIdx != i) {
-          myChildren.removeAll(aNode);
-          myChildren.insert(aIdx, aNode);
-          i = 0;
-          continue;
+    if (myChildren.size() > 1) {
+      int i = 0;
+      ModuleBase_ITreeNode* aNode = 0;
+      ObjectPtr aObject;
+      int aIdx;
+      while (i < myChildren.size()) {
+        aNode = myChildren.at(i);
+        aObject = aNode->object();
+        if (aObject.get()) {
+          aIdx = aObject->document()->index(aObject, true);
+          if (aIdx != i) {
+            myChildren.removeAll(aNode);
+            myChildren.insert(aIdx, aNode);
+            i = 0;
+            continue;
+          }
         }
+        i++;
       }
-      i++;
     }
   }