From: vsv Date: Tue, 25 Sep 2018 13:30:04 +0000 (+0300) Subject: Avoid unlimited cycling on nodes sorting X-Git-Tag: V9_2_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc5dfd1eb4b686cc815bd27530095960caa4eab2;p=modules%2Fshaper.git Avoid unlimited cycling on nodes sorting --- diff --git a/src/ModuleBase/ModuleBase_ITreeNode.h b/src/ModuleBase/ModuleBase_ITreeNode.h index 77d1d2a46..c188dd97e 100644 --- a/src/ModuleBase/ModuleBase_ITreeNode.h +++ b/src/ModuleBase/ModuleBase_ITreeNode.h @@ -183,7 +183,10 @@ protected: ModuleBase_ITreeNode* aNode = 0; ObjectPtr aObject; int aIdx; - while (i < myChildren.size()) { + int aCount = 0; + int aSize = myChildren.size(); + while (i < aSize) { + aCount++; aNode = myChildren.at(i); aObject = aNode->object(); if (aObject.get()) { @@ -196,6 +199,9 @@ protected: } } i++; + // To avoid unlimited cycling + if (aCount > aSize * aSize) + break; } } }