From e02d42d1c0abc5b832ed933f0eb74006f186d4a8 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 21 Nov 2012 13:46:34 +0000 Subject: [PATCH] 0021990: EDF 2481: Importing e medfile freezes the application --- src/SUIT/SUIT_ExceptionHandler.cxx | 24 +++++++++++++++++++++++- src/SUIT/SUIT_ExceptionHandler.h | 12 ++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/SUIT/SUIT_ExceptionHandler.cxx b/src/SUIT/SUIT_ExceptionHandler.cxx index 9a616557f..b1fa95b1b 100755 --- a/src/SUIT/SUIT_ExceptionHandler.cxx +++ b/src/SUIT/SUIT_ExceptionHandler.cxx @@ -65,6 +65,28 @@ void SUIT_ExceptionHandler::showMessage( const QString& title, const QString& ms while ( QApplication::overrideCursor() ) QApplication::restoreOverrideCursor(); - + + cleanUp(); + SUIT_MessageBox::critical( 0, title, msg ); } + +CleanUpFuncList SUIT_ExceptionHandler::myCleanUpFunctions; + +void SUIT_ExceptionHandler::addCleanUpRoutine(CleanUpFunction p) +{ + myCleanUpFunctions.append(p); +} + +void SUIT_ExceptionHandler::removeCleanUpRoutine(CleanUpFunction p) +{ + myCleanUpFunctions.removeAll(p); +} + +void SUIT_ExceptionHandler::cleanUp() +{ + foreach( QtCleanUpFunction f, myCleanUpFunctions ) + { + f(); + } +} diff --git a/src/SUIT/SUIT_ExceptionHandler.h b/src/SUIT/SUIT_ExceptionHandler.h index 53922d2c0..ea67fc1b7 100755 --- a/src/SUIT/SUIT_ExceptionHandler.h +++ b/src/SUIT/SUIT_ExceptionHandler.h @@ -24,19 +24,31 @@ #define SUIT_EXCEPTIONHANDLER_H #include "SUIT.h" +#include class QEvent; class QObject; class QString; +typedef void (*CleanUpFunction)(); +typedef QList CleanUpFuncList; + class SUIT_EXPORT SUIT_ExceptionHandler { public: + static void addCleanUpRoutine(CleanUpFunction p); + static void removeCleanUpRoutine(CleanUpFunction p); + virtual bool handle( QObject*, QEvent* ); protected: bool internalHandle( QObject*, QEvent* ); void showMessage( const QString&, const QString& ); + +private: + void cleanUp(); + + static CleanUpFuncList myCleanUpFunctions; }; extern "C" -- 2.39.2