From: vsv Date: Fri, 7 Sep 2018 15:30:17 +0000 (+0300) Subject: Issue #2630: Prevent cycling of children nodes sorting. X-Git-Tag: V9_2_0a1~46 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3baccdc56fe8ee28805f2424687f25d2ff16f6b0;p=modules%2Fshaper.git Issue #2630: Prevent cycling of children nodes sorting. --- diff --git a/src/ModuleBase/ModuleBase_ITreeNode.h b/src/ModuleBase/ModuleBase_ITreeNode.h index fcd6c7bd4..77d1d2a46 100644 --- a/src/ModuleBase/ModuleBase_ITreeNode.h +++ b/src/ModuleBase/ModuleBase_ITreeNode.h @@ -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++; } }