From a2964ec68a292547719fede66752cbc13582697a Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Mon, 12 Mar 2018 18:57:06 +0100
Subject: [PATCH] ENH: catch the ProcessAborted exception

---
 .../Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx  | 1 -
 Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx     | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
index 9053fa9326..7700ef8f2b 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
@@ -517,7 +517,6 @@ int Application::ExecuteAndWriteOutput()
         }
     }
 
-  // TODO: only if no Stop() was called
   this->AfterExecuteAndWriteOutputs();
 
   m_Chrono.Stop();
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx
index eaef5e473b..5d458d0f15 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx
@@ -331,6 +331,10 @@ AppliThread
     m_Application->GetLogger()->Fatal(string("Cannot open image ") + err.m_Filename + string(". ") + err.GetDescription() + string("\n"));
     emit ExceptionRaised( err.what() );
   }
+  catch(itk::ProcessAborted& err)
+  {
+    m_Application->GetLogger()->Info("Processing aborted\n");
+  }
   catch(itk::ExceptionObject& err)
   {
     m_Application->GetLogger()->Debug("Caught itk::ExceptionObject during application execution:\n");
-- 
GitLab