From 20658054d8bd6380b4b175b552ccc1480c49d01c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 11 Oct 2010 15:20:03 +0100 Subject: #i112786# make ConfigManager a well-behaved singleton --- desktop/source/app/app.cxx | 8 ++++---- 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 +++--- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 689b808fac75..fe9be77b4ab4 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 c4cc7149ab6d..5e682f36c056 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 be1ba436d3de..82124cd89f24 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 94cb1e973bfd..54a58cda72a7 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 7484d96b0c98..6ed64da6cff7 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 0879e3574da3..3cdd595666cc 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 ) ) -- cgit