diff --git a/smtk/operation/Operation.cxx b/smtk/operation/Operation.cxx index 041cc1261c0bc8fcdbcb01d3bf1f4564b31baf40..0f4d6dcb7c071a6ba2f3190afd25667ba0807737 100644 --- a/smtk/operation/Operation.cxx +++ b/smtk/operation/Operation.cxx @@ -324,8 +324,22 @@ Operation::Result Operation::operate(const BaseKey& key) smtk::attribute::IntItem::Ptr debugItem = this->parameters()->findInt("debug level"); m_debugLevel = ((debugItem && debugItem->isEnabled()) ? debugItem->value() : 0); - // Perform the derived operation. - result = this->operateInternal(); + try + { + // Perform the derived operation. + result = this->operateInternal(); + } + catch (const std::exception& e) + { + // Report that the operation failed due to unhandled exception. + // This allows the operation to return normally so that + // any threads do not continue to be blocked. + result = this->createResult(Outcome::FAILED); + smtkErrorMacro( + this->log(), + "An unhandled exception (" << e.what() << ") occurred in " << this->typeName() << "."); + } + // Post-process the result if the operation was successful. outcome = static_cast(result->findInt("outcome")->value()); if (outcome == Outcome::SUCCEEDED)