From: mpv Date: Fri, 25 Dec 2015 18:16:49 +0000 (+0300) Subject: Fix for the issue #1179 X-Git-Tag: V_2.1.0~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=456bdfb3bcd49ad66b0c8712be81a94f3baf6e06;p=modules%2Fshaper.git Fix for the issue #1179 --- diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index 42f04f66a..067b3c6df 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -61,7 +61,7 @@ static const int kFlagDeleted = 2; // invalid data const static std::shared_ptr kInvalid(new Model_Data()); -Model_Data::Model_Data() : mySendAttributeUpdated(true) +Model_Data::Model_Data() : mySendAttributeUpdated(true), myWasChangedButBlocked(false) { } @@ -268,17 +268,28 @@ void Model_Data::sendAttributeUpdated(ModelAPI_Attribute* theAttr) { theAttr->setInitialized(); if (theAttr->isArgument()) { - static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); - ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); - if (mySendAttributeUpdated && myObject) { - myObject->attributeChanged(theAttr->id()); + if (mySendAttributeUpdated) { + if (myObject) { + myObject->attributeChanged(theAttr->id()); + static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); + } + } else { + myWasChangedButBlocked = true; } } } void Model_Data::blockSendAttributeUpdated(const bool theBlock) { - mySendAttributeUpdated = !theBlock; + if (mySendAttributeUpdated == theBlock) { + mySendAttributeUpdated = !theBlock; + if (mySendAttributeUpdated && myWasChangedButBlocked) { // so, now it is ok to send the update signal + static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); + myWasChangedButBlocked = false; + } + } } void Model_Data::erase() diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index da40e7d4a..136ffd557 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -55,6 +55,8 @@ class Model_Data : public ModelAPI_Data std::set myRefsToMe; /// flag that may block the "attribute updated" sending bool mySendAttributeUpdated; + /// if some attribute was changed, but mySendAttributeUpdated was false, this flag stores this + bool myWasChangedButBlocked; /// Returns label of this feature TDF_Label label()