From fa1341634c9cf383723a614acce0f227f034302c Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 10 Jul 2017 14:49:06 +0300 Subject: [PATCH] Fix for the issue #2217: catch exceptions on update of attributes. --- src/Model/Model_Data.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index 7bfa1c237..867614ca3 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -307,7 +307,14 @@ void Model_Data::sendAttributeUpdated(ModelAPI_Attribute* theAttr) if (theAttr->isArgument()) { if (mySendAttributeUpdated) { if (myObject) { - myObject->attributeChanged(theAttr->id()); + try { + myObject->attributeChanged(theAttr->id()); + } catch(...) { + if (owner().get() && owner()->data().get() && owner()->data()->isValid()) { + Events_InfoMessage("Model_Data", + "%1 has failed during the update").arg(owner()->data()->name()).send(); + } + } static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); } @@ -339,7 +346,14 @@ bool Model_Data::blockSendAttributeUpdated(const bool theBlock, const bool theSe myWasChangedButBlocked.clear(); std::list::iterator aChangedIter = aWasChangedButBlocked.begin(); for(; aChangedIter != aWasChangedButBlocked.end(); aChangedIter++) { - myObject->attributeChanged((*aChangedIter)->id()); + try { + myObject->attributeChanged((*aChangedIter)->id()); + } catch(...) { + if (owner().get() && owner()->data().get() && owner()->data()->isValid()) { + Events_InfoMessage("Model_Data", + "%1 has failed during the update").arg(owner()->data()->name()).send(); + } + } } static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent); -- 2.39.2