[Libreoffice-commits] .: Branch 'libreoffice-3-3' - framework/inc framework/source sfx2/source

David Tardon dtardon at kemper.freedesktop.org
Mon Nov 22 04:50:25 PST 2010


 framework/inc/services/desktop.hxx    |    4 +++
 framework/source/services/desktop.cxx |   35 ++++++++++++++++++++++++++++++++++
 sfx2/source/appl/shutdowniconunx.cxx  |   16 ++++++++++-----
 3 files changed, 50 insertions(+), 5 deletions(-)

New commits:
commit a695cce9540178845ac294083a7f0c94c3f73542
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Nov 22 09:28:34 2010 +0100

    rhbz#650170# shutdown quickstarter at end of desktop session

diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index c1cc855..45e91d0 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 d0a4a8e..d59b361 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -83,6 +83,7 @@
 //_________________________________________________________________________________________________________________
 //	includes of other projects
 //_________________________________________________________________________________________________________________
+#include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/factory.hxx>
@@ -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.
@@ -291,6 +293,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 );
 
     SYNCHRONIZED_START
diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx
index 510c6ca..3bb5b77 100644
--- a/sfx2/source/appl/shutdowniconunx.cxx
+++ b/sfx2/source/appl/shutdowniconunx.cxx
@@ -66,11 +66,14 @@ static void systray_disable_cb()
 
 static void exit_quickstarter_cb( GtkWidget * )
 {
-    egg_tray_icon_cancel_message (pTrayIcon, 1 );
-    plugin_shutdown_sys_tray();
-    //terminate may cause this .so to be unloaded. So we must be hands off
-    //all calls into this .so after this call
-    ShutdownIcon::terminateDesktop();
+    if (pTrayIcon)
+    {
+        egg_tray_icon_cancel_message (pTrayIcon, 1 );
+        plugin_shutdown_sys_tray();
+        //terminate may cause this .so to be unloaded. So we must be hands off
+        //all calls into this .so after this call
+        ShutdownIcon::terminateDesktop();
+    }
 }
 
 static void menu_deactivate_cb( GtkWidget *pMenu )
@@ -396,6 +399,9 @@ void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
     // disable shutdown
     pShutdownIcon->SetVeto( true );
     pShutdownIcon->addTerminateListener();
+
+    g_signal_connect(GTK_WIDGET(pTrayIcon), "destroy",
+            G_CALLBACK(exit_quickstarter_cb), NULL);
 }
 
 void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()


More information about the Libreoffice-commits mailing list