]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #2217: catch exceptions on update of attributes.
authormpv <mpv@opencascade.com>
Mon, 10 Jul 2017 11:49:06 +0000 (14:49 +0300)
committermpv <mpv@opencascade.com>
Mon, 10 Jul 2017 11:49:06 +0000 (14:49 +0300)
src/Model/Model_Data.cpp

index 7bfa1c237ceed03f19f6bbf5548889ec7f714c4a..867614ca3fb39f5668446b30e6af1b83ef37a38a 100644 (file)
@@ -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<ModelAPI_Attribute*>::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);