From: mpv Date: Thu, 10 Sep 2015 16:35:08 +0000 (+0300) Subject: Fix for the issue #937 and crashes: X-Git-Tag: V_1.4.0_beta4~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc19b4c930a9c2cf5db509fc81586deab00e7417;p=modules%2Fshaper.git Fix for the issue #937 and crashes: --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 21f5f1aa4..d85fb7b29 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -68,6 +68,8 @@ Model_Document::Model_Document(const std::string theID, const std::string theKin // in transaction for nesting correct working myDoc->NewCommand(); TDataStd_Integer::Set(myDoc->Main().Father(), 0); + // this to avoid creation of integer attribute outside the transaction after undo + transactionID(); myDoc->CommitCommand(); } @@ -278,6 +280,7 @@ void Model_Document::close(const bool theForever) // close all only if it is really asked, otherwise it can be undoed/redoed if (theForever) { + // flush everything to avoid messages with bad objects delete myObjs; myObjs = 0; if (myDoc->CanClose() == CDM_CCS_OK) diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 988b2eb87..b30356fff 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -79,6 +79,7 @@ Model_Objects::~Model_Objects() myFeatures.UnBind(aFeaturesIter.Key()); } aLoop->activateFlushes(isActive); + aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); @@ -611,6 +612,16 @@ void Model_Objects::synchronizeFeatures( aKeptFeatures.insert(aFeature); if (anUpdatedMap.Contains(aFeatureLabel)) { ModelAPI_EventCreator::get()->sendUpdated(aFeature, anUpdateEvent); + if (aFeature->getKind() == "Parameter") { // if parameters are changed, update the results (issue 937) + const std::list >& aResults = aFeature->results(); + std::list >::const_iterator aRIter = aResults.begin(); + for (; aRIter != aResults.cend(); aRIter++) { + std::shared_ptr aRes = *aRIter; + if (aRes->data()->isValid() && !aRes->isDisabled()) { + ModelAPI_EventCreator::get()->sendUpdated(aRes, anUpdateEvent); + } + } + } } } }