[Libreoffice-commits] .: 4 commits - framework/inc framework/source sfx2/source vcl/inc vcl/unx

Bjoern Michaelsen bmichaelsen at kemper.freedesktop.org
Tue Feb 28 05:31:16 PST 2012


 framework/inc/services/desktop.hxx            |    4 +
 framework/source/services/desktop.cxx         |   30 ++++++++
 framework/source/services/sessionlistener.cxx |   27 +++++++
 sfx2/source/appl/shutdownicon.cxx             |    1 
 vcl/inc/unx/sm.hxx                            |    1 
 vcl/unx/generic/app/sm.cxx                    |   96 ++++++++++----------------
 6 files changed, 100 insertions(+), 59 deletions(-)

New commits:
commit 5279616d50b0394e8ec6d8e2109471ca649412b7
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Feb 28 14:29:06 2012 +0100

    lp#562027: fix logout with quickstarter

diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index ac51f25..530d615 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -339,6 +339,10 @@ class Desktop   :   // interfaces
         virtual ::rtl::OUString SAL_CALL getUntitledPrefix()
             throw (css::uno::RuntimeException);
 
+        // we need this wrapped terminate()-call to terminate even the QuickStarter
+        // non-virtual and non-UNO for now
+        bool SAL_CALL terminateQuickstarterToo()
+            throw( css::uno::RuntimeException );
     //-------------------------------------------------------------------------------------------------------------
     //  protected methods
     //-------------------------------------------------------------------------------------------------------------
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index eccd010..6c63aea 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -401,6 +401,36 @@ sal_Bool SAL_CALL Desktop::terminate()
     return bTerminate;
 }
 
+namespace
+{
+    class QuickstartSuppressor
+    {
+        Desktop* const m_pDesktop;
+        css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher;
+        public:
+            QuickstartSuppressor(Desktop* const pDesktop, css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher)
+                : m_pDesktop(pDesktop)
+                , m_xQuickLauncher(xQuickLauncher)
+            {
+                SAL_INFO("fwk.desktop", "temporary removing Quickstarter");
+                if(m_xQuickLauncher.is())
+                    m_pDesktop->removeTerminateListener(m_xQuickLauncher);
+            }
+            ~QuickstartSuppressor()
+            {
+                SAL_INFO("fwk.desktop", "readding Quickstarter");
+                if(m_xQuickLauncher.is())
+                    m_pDesktop->addTerminateListener(m_xQuickLauncher);
+            }
+    };
+}
+
+bool SAL_CALL Desktop::terminateQuickstarterToo()
+    throw( css::uno::RuntimeException )
+{
+    QuickstartSuppressor(this, m_xQuickLauncher);
+    return terminate();
+}
 
 //=============================================================================
 void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener )
diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx
index b6c94b2..92b479d 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -30,6 +30,7 @@
 // my own includes
 
 #include <services/sessionlistener.hxx>
+#include <services/desktop.hxx>
 #include <threadhelp/readguard.hxx>
 #include <threadhelp/resetableguard.hxx>
 #include <protocols.h>
@@ -326,7 +327,19 @@ void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted
             StoreSession( sal_False );
 
             css::uno::Reference< css::frame::XDesktop > xDesktop( m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
-            m_bTerminated = xDesktop->terminate();
+            // honestly: how many implementations of XDesktop will we ever have?
+            // so casting this directly to the implementation
+            Desktop* pDesktop(dynamic_cast<Desktop*>(xDesktop.get()));
+            if(pDesktop)
+            {
+                SAL_INFO("fwk.session", "XDesktop is a framework::Desktop -- good.");
+                m_bTerminated = pDesktop->terminateQuickstarterToo();
+            }
+            else
+            {
+                SAL_WARN("fwk.session", "XDesktop is not a framework::Desktop -- this should never happen.");
+                m_bTerminated = xDesktop->terminate();
+            }
 
             if ( m_rSessionManager.is() )
             {
commit 478485d19f290f417f824dbecad3e3588bf553f5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Feb 28 14:27:41 2012 +0100

    some fancy new SAL_LOG tracing for sfx2

diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index ffaa63d..2f56e0b 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -686,6 +686,7 @@ void SAL_CALL ShutdownIcon::disposing( const ::com::sun::star::lang::EventObject
 void SAL_CALL ShutdownIcon::queryTermination( const ::com::sun::star::lang::EventObject& )
 throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException)
 {
+    SAL_INFO("sfx2.shutdown", "ShutdownIcon::queryTermination: veto is " << m_bVeto);
     ::osl::ClearableMutexGuard  aGuard( m_aMutex );
 
     if ( m_bVeto )
commit 423d346e21da300fad386c06b138c7fa086b133d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Feb 28 14:27:20 2012 +0100

    some fancy new SAL_LOG tracing for framework

diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx
index 524a14c..b6c94b2 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -136,10 +136,12 @@ SessionListener::SessionListener(const css::uno::Reference< css::lang::XMultiSer
         , m_bAllowUserInteractionOnQuit( sal_False )
         , m_bTerminated( sal_False )
 {
+    SAL_INFO("fwk.session", "SessionListener::SessionListener");
 }
 
 SessionListener::~SessionListener()
 {
+    SAL_INFO("fwk.session", "SessionListener::~SessionListener");
     if (m_rSessionManager.is())
     {
         css::uno::Reference< XSessionManagerListener> me(this);
@@ -149,6 +151,7 @@ SessionListener::~SessionListener()
 
 void SessionListener::StoreSession( sal_Bool bAsync )
 {
+    SAL_INFO("fwk.session", "SessionListener::StoreSession");
     ResetableGuard aGuard(m_aLock);
     try
     {
@@ -182,6 +185,7 @@ void SessionListener::StoreSession( sal_Bool bAsync )
 
 void SessionListener::QuitSessionQuietly()
 {
+    SAL_INFO("fwk.session", "SessionListener::QuitSessionQuietly");
     ResetableGuard aGuard(m_aLock);
     try
     {
@@ -206,11 +210,13 @@ void SessionListener::QuitSessionQuietly()
 
 void SAL_CALL SessionListener::disposing(const com::sun::star::lang::EventObject&) throw (RuntimeException)
 {
+    SAL_INFO("fwk.session", "SessionListener::disposing");
 }
 
 void SAL_CALL SessionListener::initialize(const Sequence< Any  >& args)
     throw (RuntimeException)
 {
+    SAL_INFO("fwk.session", "SessionListener::initialize");
 
     OUString aSMgr(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.SessionManagerClient"));
     if (args.getLength() > 0)
@@ -242,6 +248,7 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any  >& args)
 void SAL_CALL SessionListener::statusChanged(const FeatureStateEvent& event)
     throw (css::uno::RuntimeException)
 {
+   SAL_INFO("fwk.session", "SessionListener::statusChanged");
    if (event.FeatureURL.Complete.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.autorecovery:/doSessionRestore")))
     {
         if (event.FeatureDescriptor.compareToAscii("update")==0)
@@ -262,6 +269,7 @@ void SAL_CALL SessionListener::statusChanged(const FeatureStateEvent& event)
 sal_Bool SAL_CALL SessionListener::doRestore()
     throw (RuntimeException)
 {
+    SAL_INFO("fwk.session", "SessionListener::doRestore");
     ResetableGuard aGuard(m_aLock);
     m_bRestored = sal_False;
     try {
@@ -288,6 +296,7 @@ sal_Bool SAL_CALL SessionListener::doRestore()
 void SAL_CALL SessionListener::doSave( sal_Bool bShutdown, sal_Bool /*bCancelable*/ )
     throw (RuntimeException)
 {
+    SAL_INFO("fwk.session", "SessionListener::doSave");
     if (bShutdown)
     {
         m_bSessionStoreRequested = sal_True; // there is no need to protect it with mutex
@@ -304,6 +313,7 @@ void SAL_CALL SessionListener::doSave( sal_Bool bShutdown, sal_Bool /*bCancelabl
 void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted )
     throw (RuntimeException)
 {
+    SAL_INFO("fwk.session", "SessionListener::approveInteraction");
     // do AutoSave as the first step
     ResetableGuard aGuard(m_aLock);
 
@@ -345,6 +355,7 @@ void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted
 void SessionListener::shutdownCanceled()
     throw (RuntimeException)
 {
+    SAL_INFO("fwk.session", "SessionListener::shutdownCanceled");
     // set the state back
     m_bSessionStoreRequested = sal_False; // there is no need to protect it with mutex
 }
@@ -352,6 +363,7 @@ void SessionListener::shutdownCanceled()
 void SessionListener::doQuit()
     throw (RuntimeException)
 {
+    SAL_INFO("fwk.session", "SessionListener::doQuit");
     if ( m_bSessionStoreRequested && !m_bTerminated )
     {
         // let the session be closed quietly in this case
commit 0039d23914bfbbfcc1cb8d68c413f2e336054b96
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Tue Feb 28 14:24:42 2012 +0100

    move vcl session management to fancy new SAL_LOG tracing

diff --git a/vcl/inc/unx/sm.hxx b/vcl/inc/unx/sm.hxx
index 0dfc463..3af55f5 100644
--- a/vcl/inc/unx/sm.hxx
+++ b/vcl/inc/unx/sm.hxx
@@ -64,6 +64,7 @@ class SessionManagerClient
     DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* );
     DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* );
 public:
+    SessionManagerClient();
     static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export
     static void close();
 
diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx
index 1bb290c..75af64c 100644
--- a/vcl/unx/generic/app/sm.cxx
+++ b/vcl/unx/generic/app/sm.cxx
@@ -54,29 +54,6 @@
 
 #define USE_SM_EXTENSION
 
-#if OSL_DEBUG_LEVEL > 1
-#include <cstdarg>
-static bool bFirstAssert = true;
-#endif
-
-#if OSL_DEBUG_LEVEL > 1
-inline void SMprintf( const char* pFormat, ... )
-#else
-inline void SMprintf( const char*, ... )
-#endif
-{
-#if OSL_DEBUG_LEVEL > 1
-    FILE* fp = fopen( "/tmp/sessionlog.txt", bFirstAssert ? "w" : "a" );
-    if(!fp) return;
-    bFirstAssert = false;
-    std::va_list ap;
-    va_start( ap, pFormat );
-    vfprintf( fp, pFormat, ap );
-    fclose( fp );
-    va_end( ap );
-#endif
-};
-
 static IceSalSession* pOneInstance = NULL;
 
 SalSession* X11SalInstance::CreateSalSession()
@@ -265,6 +242,11 @@ static void BuildSmPropertyList()
     }
 }
 
+SessionManagerClient::SessionManagerClient()
+{
+    SAL_INFO("vcl.sm","SessionManagerClient::SessionManagerClient()");
+}
+
 bool SessionManagerClient::checkDocumentsSaved()
 {
     return bDocSaveDone;
@@ -272,7 +254,7 @@ bool SessionManagerClient::checkDocumentsSaved()
 
 IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG )
 {
-    SMprintf( "posting save documents event shutdown = %s\n", (pThis!=0) ? "true" : "false" );
+    SAL_INFO("vcl.sm", "posting save documents event shutdown = " << ((pThis!=0) ? "true" : "false" ));
 
     static bool bFirstShutdown=true;
     if (pThis != 0 && bFirstShutdown) //first shutdown request
@@ -311,7 +293,7 @@ IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG )
 
 IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, InteractionHdl, void*, EMPTYARG )
 {
-    SMprintf( "interaction link\n" );
+    SAL_INFO("vcl.sm", "interaction link");
     if( pOneInstance )
     {
         SalSessionInteractionEvent aEvent( true );
@@ -323,7 +305,7 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, InteractionHdl, void*, EMPTYA
 
 IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownCancelHdl, void*, EMPTYARG )
 {
-    SMprintf( "shutdown cancel\n" );
+    SAL_INFO("vcl.sm", "shutdown cancel");
     if( pOneInstance )
     {
         SalSessionShutdownCancelEvent aEvent;
@@ -342,16 +324,16 @@ void SessionManagerClient::SaveYourselfProc(
     Bool
     )
 {
-    SMprintf( "Session: save yourself, save_type = %s, shutdown = %s, interact_style = %s, fast = %s\n",
-              save_type == SmSaveLocal ? "SmcSaveLocal" :
-              ( save_type == SmSaveGlobal ? "SmcSaveGlobal" :
-                ( save_type == SmSaveBoth ? "SmcSaveBoth" : "<unknown>" ) ),
-              shutdown ? "true" : "false",
-              interact_style == SmInteractStyleNone ? "SmInteractStyleNone" :
-              ( interact_style == SmInteractStyleErrors ? "SmInteractStyleErrors" :
-                ( interact_style == SmInteractStyleAny ? "SmInteractStyleAny" : "<unknown>" ) ),
-              false ? "true" : "false"
-              );
+    SAL_INFO("vcl.sm", "Session: save yourself," <<
+        "save_type " <<
+            " local: " << (save_type == SmSaveLocal) <<
+            " global: " << (save_type == SmSaveGlobal) <<
+            " both: " << (save_type == SmSaveBoth) <<
+        " shutdown: " << shutdown <<
+        " interact_style: " <<
+            " SmInteractStyleNone: " << (interact_style == SmInteractStyleNone) <<
+            " SmInteractStyleErrors: " << (interact_style == SmInteractStyleErrors) <<
+            " SmInteractStyleErrors: " << (interact_style == SmInteractStyleAny));
     BuildSmPropertyList();
 #ifdef USE_SM_EXTENSION
     bDocSaveDone = false;
@@ -368,7 +350,7 @@ void SessionManagerClient::SaveYourselfProc(
     }
     sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0;
     Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) );
-    SMprintf( "waiting for save yourself event to be processed\n" );
+    SAL_INFO("vcl.sm", "waiting for save yourself event to be processed" );
 #endif
 }
 
@@ -381,7 +363,7 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG
     }
 
     const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames();
-    SMprintf( rFrames.begin() != rFrames.end() ? "shutdown on first frame\n" : "shutdown event but no frame\n" );
+    SAL_INFO("vcl.sm", (rFrames.begin() != rFrames.end() ? "shutdown on first frame" : "shutdown event but no frame"));
     if( rFrames.begin() != rFrames.end() )
         rFrames.front()->CallCallback( SALEVENT_SHUTDOWN, 0 );
     return 0;
@@ -392,11 +374,11 @@ void SessionManagerClient::DieProc(
     SmPointer
     )
 {
-    SMprintf( "Session: die\n" );
+    SAL_INFO("vcl.sm", "Session: die");
     if( connection == aSmcConnection )
     {
         Application::PostUserEvent( STATIC_LINK( NULL, SessionManagerClient, ShutDownHdl ) );
-        SMprintf( "waiting for shutdown event to be processed\n" );
+        SAL_INFO("vcl.sm", "waiting for shutdown event to be processed" );
     }
 }
 
@@ -405,14 +387,14 @@ void SessionManagerClient::SaveCompleteProc(
     SmPointer
     )
 {
-    SMprintf( "Session: save complete\n" );
+    SAL_INFO("vcl.sm", "Session: save complete");
 }
 
 void SessionManagerClient::ShutdownCanceledProc(
     SmcConn connection,
     SmPointer )
 {
-    SMprintf( "Session: shutdown canceled\n" );
+    SAL_INFO("vcl.sm", "Session: shutdown canceled" );
     if( connection == aSmcConnection )
         Application::PostUserEvent( STATIC_LINK( NULL, SessionManagerClient, ShutDownCancelHdl ) );
 }
@@ -421,7 +403,7 @@ void SessionManagerClient::InteractProc(
                                         SmcConn connection,
                                         SmPointer )
 {
-    SMprintf( "Session: interaction request completed\n" );
+    SAL_INFO("vcl.sm", "Session: interaction request completed" );
     if( connection == aSmcConnection )
         Application::PostUserEvent( STATIC_LINK( NULL, SessionManagerClient, InteractionHdl ) );
 }
@@ -433,7 +415,7 @@ void SessionManagerClient::saveDone()
         ICEConnectionObserver::lock();
         SmcSetProperties( aSmcConnection, nSmProps, ppSmProps );
         SmcSaveYourselfDone( aSmcConnection, True );
-        SMprintf( "sent SaveYourselfDone SmRestartHint of %d\n", *pSmRestartHint );
+        SAL_INFO("vcl.sm", "sent SaveYourselfDone SmRestartHint of " << *pSmRestartHint );
         bDocSaveDone = true;
         ICEConnectionObserver::unlock();
     }
@@ -477,9 +459,9 @@ void SessionManagerClient::open()
                                             sizeof( aErrBuf ),
                                             aErrBuf );
         if( ! aSmcConnection )
-            SMprintf( "SmcOpenConnection failed: %s\n", aErrBuf );
+            SAL_INFO("vcl.sm", "SmcOpenConnection failed: " << aErrBuf);
         else
-            SMprintf( "SmcOpenConnection succeeded, client ID is \"%s\"\n", pClientID );
+            SAL_INFO("vcl.sm", "SmcOpenConnection succeeded, client ID is " << pClientID );
         m_aClientID = rtl::OString(pClientID);
         free( pClientID );
         pClientID = NULL;
@@ -500,7 +482,7 @@ void SessionManagerClient::open()
         }
     }
     else if( ! aSmcConnection )
-        SMprintf( "no SESSION_MANAGER\n" );
+        SAL_INFO("vcl.sm", "no SESSION_MANAGER");
 #endif
 }
 
@@ -515,9 +497,9 @@ void SessionManagerClient::close()
     {
 #ifdef USE_SM_EXTENSION
         ICEConnectionObserver::lock();
-        SMprintf( "attempting SmcCloseConnection\n" );
+        SAL_INFO("vcl.sm", "attempting SmcCloseConnection");
         SmcCloseConnection( aSmcConnection, 0, NULL );
-        SMprintf( "SmcConnection closed\n" );
+        SAL_INFO("vcl.sm", "SmcConnection closed");
         ICEConnectionObserver::unlock();
         ICEConnectionObserver::deactivate();
 #endif
@@ -580,7 +562,7 @@ const rtl::OString& SessionManagerClient::getPreviousSessionID()
         }
     }
 
-    SMprintf( "previous ID = \"%s\"\n", aPrevId.getStr() );
+    SAL_INFO("vcl.sm", "previous ID = " << aPrevId.getStr());
     return aPrevId;
 }
 
@@ -675,7 +657,7 @@ void ICEConnectionWorker( void* )
             char buf[4];
             while( read( ICEConnectionObserver::nWakeupFiles[0], buf, sizeof( buf ) ) > 0 )
                 ;
-            SMprintf( "file handles active in wakeup: %d\n", nRet );
+            SAL_INFO("vcl.sm", "file handles active in wakeup: " << nRet);
             if( nRet == 1 )
                 continue;
         }
@@ -687,7 +669,7 @@ void ICEConnectionWorker( void* )
             nRet = poll( ICEConnectionObserver::pFilehandles+1, ICEConnectionObserver::nConnections, 0 );
             if( nRet > 0 )
             {
-                SMprintf( "IceProcessMessages\n" );
+                SAL_INFO("vcl.sm", "IceProcessMessages");
                 Bool bReply;
                 for( int i = 0; i < ICEConnectionObserver::nConnections; i++ )
                     if( ICEConnectionObserver::pFilehandles[i+1].revents & POLLIN )
@@ -697,7 +679,7 @@ void ICEConnectionWorker( void* )
         ICEConnectionObserver::unlock();
     }
 #endif
-    SMprintf( "shutting donw ICE dispatch thread\n" );
+    SAL_INFO("vcl.sm", "shutting donw ICE dispatch thread");
 }
 
 void ICEConnectionObserver::ICEWatchProc(
@@ -774,7 +756,7 @@ void ICEConnectionObserver::ICEWatchProc(
         }
         if( nConnections == 0 && ICEThread )
         {
-            SMprintf( "terminating ICEThread\n" );
+            SAL_INFO("vcl.sm", "terminating ICEThread");
             osl_terminateThread( ICEThread );
             wakeup();
             // must release the mutex here
@@ -789,10 +771,8 @@ void ICEConnectionObserver::ICEWatchProc(
             osl_acquireMutex( ICEMutex );
         }
     }
-    SMprintf( "ICE connection on %d %s\n",
-              IceConnectionNumber( connection ),
-              opening ? "inserted" : "removed" );
-    SMprintf( "Display connection is %d\n", ConnectionNumber( GetGenericData()->GetSalDisplay()->GetDisplay() ) );
+    SAL_INFO( "vcl.sm", "ICE connection on " << IceConnectionNumber( connection ) << " " << (opening ? "inserted" : "removed"));
+    SAL_INFO( "vcl.sm", "Display connection is " << ConnectionNumber( GetGenericData()->GetSalDisplay()->GetDisplay() ) );
 #endif
 }
 


More information about the Libreoffice-commits mailing list