[Libreoffice-commits] .: 3 commits - desktop/source framework/source sfx2/source uui/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Oct 12 07:37:04 PDT 2010


 desktop/source/app/app.cxx                        |    8 ++++----
 desktop/source/deployment/registry/dp_backend.cxx |    3 +++
 desktop/source/pkgchk/unopkg/unopkg_misc.cxx      |    1 +
 desktop/source/pkgchk/unopkg/unopkg_shared.h      |   18 ++++++++++++------
 framework/source/services/autorecovery.cxx        |    5 ++---
 framework/source/services/substitutepathvars.cxx  |    2 +-
 sfx2/source/appl/appinit.cxx                      |    2 +-
 sfx2/source/appl/sfxhelp.cxx                      |    2 +-
 uui/source/iahndl.cxx                             |    6 +++---
 9 files changed, 28 insertions(+), 19 deletions(-)

New commits:
commit a4d7dbf897e41a1afda6c2b6f0e5cc35920a1cf3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 11 15:20:03 2010 +0100

    #i112786# make ConfigManager a well-behaved singleton

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index fe33006..36d5d20 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -747,7 +747,7 @@ void Desktop::DeInit()
     try {
         // instead of removing of the configManager just let it commit all the changes
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
-        utl::ConfigManager::GetConfigManager()->StoreConfigItems();
+        utl::ConfigManager::GetConfigManager().StoreConfigItems();
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
 
         // close splashscreen if it's still open
@@ -777,7 +777,7 @@ BOOL Desktop::QueryExit()
     try
     {
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
-        utl::ConfigManager::GetConfigManager()->StoreConfigItems();
+        utl::ConfigManager::GetConfigManager().StoreConfigItems();
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" );
     }
     catch ( RuntimeException& )
@@ -1431,14 +1431,14 @@ USHORT Desktop::Exception(USHORT nError)
         bRestart = SaveTasks();
 
     // because there is no method to flush the condiguration data, we must dispose the ConfigManager
-    Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY );
+    Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY );
     if (xCFGFlush.is())
     {
         xCFGFlush->flush();
     }
     else
     {
-        Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY );
+        Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY );
         if (xCFGDispose.is())
             xCFGDispose->dispose();
     }
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 41dbe9b..c919895 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3698,9 +3698,8 @@ void AutoRecovery::impl_flushALLConfigChanges()
 
         // SOLAR SAFE ->
         ::vos::OGuard aGuard( Application::GetSolarMutex() );
-        ::utl::ConfigManager* pCfgMgr = ::utl::ConfigManager::GetConfigManager();
-        if (pCfgMgr)
-            pCfgMgr->StoreConfigItems();
+        ::utl::ConfigManager& rCfgMgr = ::utl::ConfigManager::GetConfigManager();
+        rCfgMgr.StoreConfigItems();
     }
     catch(const css::uno::Exception&)
         {}
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index f88f040..ae123cb 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -1205,7 +1205,7 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable
     // Detect the language type of the current office
     aPreDefPathVariables.m_eLanguageType = LANGUAGE_ENGLISH_US;
     rtl::OUString aLocaleStr;
-    if ( utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty( utl::ConfigManager::LOCALE ) >>= aLocaleStr )
+    if ( utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( utl::ConfigManager::LOCALE ) >>= aLocaleStr )
         aPreDefPathVariables.m_eLanguageType = MsLangId::convertIsoStringToLanguage( aLocaleStr );
     else
     {
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 82f2353..84876a2 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -127,7 +127,7 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
         xDesktop->removeTerminateListener( this );
 
     ::vos::OGuard aGuard( Application::GetSolarMutex() );
-    utl::ConfigManager::GetConfigManager()->StoreConfigItems();
+    utl::ConfigManager::GetConfigManager().StoreConfigItems();
     SfxApplication* pApp = SFX_APP();
     pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) );
     pApp->Get_Impl()->pAppDispatch->ReleaseAll();
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index a97063b..d997c6b 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -116,7 +116,7 @@ rtl::OUString HelpLocaleString()
     {
         // detect installed locale
         Any aLocale =
-            ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
+            ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty(
                ::utl::ConfigManager::LOCALE );
         aLocale >>= aLocaleStr;
         bool bOk = aLocaleStr.getLength() != 0;
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index e90a064..f3b036d 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -1338,7 +1338,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
             {
                 uno::Any aProductNameAny =
                     ::utl::ConfigManager::GetConfigManager()
-                        ->GetDirectConfigProperty(
+                        .GetDirectConfigProperty(
                            ::utl::ConfigManager::PRODUCTNAME );
                 aProductNameAny >>= aTitle;
             }
@@ -1552,10 +1552,10 @@ UUIInteractionHelper::handleBrokenPackageRequest(
         return;
 
     uno::Any aProductNameAny =
-        ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
+        ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty(
             ::utl::ConfigManager::PRODUCTNAME );
     uno::Any aProductVersionAny =
-        ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
+        ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty(
             ::utl::ConfigManager::PRODUCTVERSION );
     ::rtl::OUString aProductName, aProductVersion;
     if ( !( aProductNameAny >>= aProductName ) )
commit 0708aa63dd280b345553f278b5a58a5676adafcc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 11 15:04:50 2010 +0100

    #i112787# fix ownership cycle

diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 7562bb2..eee4eb0 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -121,6 +121,9 @@ void PackageRegistryBackend::check()
 void PackageRegistryBackend::disposing()
 {
     try {
+        for ( t_string2ref::const_iterator i = m_bound.begin(); i != m_bound.end(); i++)
+            i->second->removeEventListener(this);
+        m_bound.clear();
         m_xComponentContext.clear();
         WeakComponentImplHelperBase::disposing();    
     }
commit dd53d144e66f603e06f2318abd8fec5353d76cf0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 11 14:51:39 2010 +0100

    #i112760# deinitialize ucb when shutting down unopkg

diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index ec4bab4..cfee03b 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -396,6 +396,7 @@ Reference<XComponentContext> bootstrapStandAlone(
     if (! ::ucbhelper::ContentBroker::initialize( xServiceManager, ucb_args ))
         throw RuntimeException( OUSTR("cannot initialize UCB!"), 0 );
     
+    disposeGuard.setDeinitUCB();
     return xContext;
 }
 
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h
index 5af217e..3589852 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -34,6 +34,7 @@
 #include "tools/resmgr.hxx"
 #include "rtl/ustring.hxx"
 #include "unotools/configmgr.hxx"
+#include "ucbhelper/contentbroker.hxx"
 
 
 #define APP_NAME "unopkg"
@@ -137,15 +138,14 @@ bool isBootstrapVariable(sal_uInt32 * pIndex);
 class DisposeGuard
 {
     css::uno::Reference<css::lang::XComponent> m_xComp;
-    
+    bool m_bDeinitUCB;
 public:
-    inline DisposeGuard() {}
-    inline DisposeGuard(
-        css::uno::Reference<css::lang::XComponent> const & xComp )
-        : m_xComp( xComp ) {}
-    
+    DisposeGuard(): m_bDeinitUCB(false) {}
     inline ~DisposeGuard()
     {
+        if (m_bDeinitUCB)
+            ::ucbhelper::ContentBroker::deinitialize();
+
         if (m_xComp.is())
             m_xComp->dispose();
     }
@@ -155,6 +155,12 @@ public:
     {
         m_xComp = xComp;
     }
+
+    inline void setDeinitUCB()
+    {
+        m_bDeinitUCB = true;
+    }
+
 };
 
 //==============================================================================


More information about the Libreoffice-commits mailing list