From d90b0ebc59e9912d66b66fd242243908b39255a3 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Mon, 22 Nov 2010 09:28:34 +0100 Subject: rhbz#650170# shutdown quickstarter at end of desktop session --- framework/inc/services/desktop.hxx | 4 ++++ framework/source/services/desktop.cxx | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'framework') diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx index 8dcc87227780..79e04ca967ac 100644 --- a/framework/inc/services/desktop.hxx +++ b/framework/inc/services/desktop.hxx @@ -429,6 +429,8 @@ class Desktop : // interfaces */ ::sal_Bool impl_closeFrames(::sal_Bool bAllowUI); + sal_Bool impl_terminate(); + //------------------------------------------------------------------------------------------------------------- // debug methods // (should be private everytime!) @@ -507,6 +509,8 @@ class Desktop : // interfaces css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator; + bool m_bTerminating; // we are in the process of terminating already + }; // class Desktop } // namespace framework diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 1c862faf36bf..216c7a94624c 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -83,6 +83,7 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include #include #include #include @@ -264,6 +265,7 @@ Desktop::Desktop( const css::uno::Reference< css::lang::XMultiServiceFactory >& , m_xSWThreadManager ( ) , m_xSfxTerminator ( ) , m_xTitleNumberGenerator ( ) + , m_bTerminating(false) { // Safe impossible cases // We don't accept all incoming parameter. @@ -290,6 +292,39 @@ Desktop::~Desktop() //============================================================================= sal_Bool SAL_CALL Desktop::terminate() throw( css::uno::RuntimeException ) +{ + bool bTerminating(false); + { + WriteGuard aGuard(m_aLock); + bTerminating = m_bTerminating; + m_bTerminating = true; + } + if (bTerminating) + return false; + + css::uno::Any aException; + sal_Bool bTerminate(false); + try + { + bTerminate = impl_terminate(); + } + catch (const css::uno::RuntimeException& rEx) + { + aException <<= rEx; + } + + { + WriteGuard aGuard(m_aLock); + m_bTerminating = false; + } + + if (aException.hasValue()) + cppu::throwException(aException); + + return bTerminate; +} + +sal_Bool Desktop::impl_terminate() { TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); -- cgit