From: mpv Date: Tue, 12 Apr 2016 06:18:42 +0000 (+0300) Subject: Stop the infinitive cycling loop in update if bad dependencies graph presented in... X-Git-Tag: V_2.3.0~246 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b011d40eb8851e43f811abf6ac213c6580d83ef7;p=modules%2Fshaper.git Stop the infinitive cycling loop in update if bad dependencies graph presented in the tree. --- diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index bb7b68163..ae28fb724 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -302,6 +302,18 @@ bool Model_Update::processFeature(FeaturePtr theFeature) return false; } + if (myProcessed.find(theFeature) == myProcessed.end()) { + myProcessed[theFeature] = 0; + } else { + int aCount = myProcessed[theFeature]; + if (aCount > 100) { // too many repetition of processing (in VS it may crash on 330 with stack overflow) + Events_Error::send( + "Feature '" + theFeature->data()->name() + "' is updtated in infinitive loop"); + return false; + } + myProcessed[theFeature] = aCount + 1; + } + // check this feature is not yet checked or processed bool aIsModified = myModified.find(theFeature) != myModified.end(); if (!aIsModified && myIsFinish) { // get info about the modification for features without preview diff --git a/src/Model/Model_Update.h b/src/Model/Model_Update.h index 106b48cbc..c9fe39ab7 100644 --- a/src/Model/Model_Update.h +++ b/src/Model/Model_Update.h @@ -39,7 +39,8 @@ class Model_Update : public Events_Listener bool myIsProcessed; /// set that contains features that must be executed only on finish of the operation std::set > myProcessOnFinish; - + /// to avoid infinitive cycling: feature -> count of the processing periods during this update + std::map, int > myProcessed; public: /// Is called only once, on startup of the application