From 4d4138b1f0a6b32e147d79f2a5beaa89906b9bc4 Mon Sep 17 00:00:00 2001 From: caremoli Date: Thu, 27 Jan 2011 10:57:06 +0000 Subject: [PATCH] CCAR: catch all exceptions in qt handler and abort session server if exception has been caught in orb shutdown --- src/Session/SALOME_Session_Server.cxx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 507c39992..851557ce0 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -290,8 +290,18 @@ public: return myHandler ? myHandler->handle( receiver, e ) : TestApplication::notify( receiver, e ); #else - return myHandler ? myHandler->handle( receiver, e ) : - QApplication::notify( receiver, e ); + try + { + return myHandler ? myHandler->handle( receiver, e ) : QApplication::notify( receiver, e ); + } + catch(std::exception& e) + { + std::cerr << e.what() << std::endl; + } + catch(...) + { + std::cerr << "Unknown exception caught in Qt handler: it's probably a bug in SALOME platform" << std::endl; + } #endif } SUIT_ExceptionHandler* handler() const { return myHandler; } @@ -604,7 +614,10 @@ int main( int argc, char **argv ) // exception is raised when orb->destroy() is called and // cpp continer is launched in the embedded mode ////////////////////////////////////////////////////////////// - // std::cerr << "Caught unexpected exception on destroy : ignored !!" << std::endl; + // std::cerr << "Caught unexpected exception on shutdown : ignored !!" << std::endl; + if ( shutdown ) + killOmniNames(); + abort(); //abort program to avoid deadlock in destructors or atexit when shutdown has been interrupted } PyGILState_Ensure(); -- 2.39.2