diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-11 17:04:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-12 08:57:13 +0200 |
commit | 6b7d8f4f5f7b4595b29f1ae00c2de4393265d307 (patch) | |
tree | 6acc3e3afc9bf6b97a14917d8ffbb573730f6c77 /sc | |
parent | c6d3e81669124caff72f32ec901f96f8303c069e (diff) |
use unique_ptr for ScUserList in ScGlobal
Change-Id: Ic7ecb6f67e2dc7ba77c73d0d0eccb758dfed8e33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100538
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/global.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 19 |
2 files changed, 10 insertions, 11 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 44b35c003fc1..31c26e8f2db9 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -506,7 +506,7 @@ class ScGlobal static ScAutoFormat* pAutoFormat; static std::atomic<LegacyFuncCollection*> pLegacyFuncCollection; static std::atomic<ScUnoAddInCollection*> pAddInCollection; - static ScUserList* pUserList; + static std::unique_ptr<ScUserList> xUserList; static std::map<const char*, OUString>* pRscString; static SC_DLLPUBLIC const OUString aEmptyOUString; static OUString aStrClipDocName; diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 0fc9977ce7f7..02697c0eb84b 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -76,7 +76,7 @@ SvxSearchItem* ScGlobal::pSearchItem = nullptr; ScAutoFormat* ScGlobal::pAutoFormat = nullptr; std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr); std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr); -ScUserList* ScGlobal::pUserList = nullptr; +std::unique_ptr<ScUserList> ScGlobal::xUserList; LanguageType ScGlobal::eLnge = LANGUAGE_SYSTEM; std::atomic<css::lang::Locale*> ScGlobal::pLocale(nullptr); std::unique_ptr<SvtSysLocale> ScGlobal::xSysLocale; @@ -280,9 +280,9 @@ ScUserList* ScGlobal::GetUserList() // Hack: Load Cfg item at the App global_InitAppOptions(); - if (!pUserList) - pUserList = new ScUserList(); - return pUserList; + if (!xUserList) + xUserList.reset(new ScUserList()); + return xUserList.get(); } void ScGlobal::SetUserList( const ScUserList* pNewList ) @@ -290,15 +290,14 @@ void ScGlobal::SetUserList( const ScUserList* pNewList ) assert(!bThreadedGroupCalcInProgress); if ( pNewList ) { - if ( !pUserList ) - pUserList = new ScUserList( *pNewList ); + if ( !xUserList ) + xUserList.reset( new ScUserList( *pNewList ) ); else - *pUserList = *pNewList; + *xUserList = *pNewList; } else { - delete pUserList; - pUserList = nullptr; + xUserList.reset(); } } @@ -533,7 +532,7 @@ void ScGlobal::Clear() DELETEZ(pSearchItem); delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr; delete pAddInCollection.load(); pAddInCollection = nullptr; - DELETEZ(pUserList); + xUserList.reset(); xStarCalcFunctionList.reset(); // Destroy before ResMgr! xStarCalcFunctionMgr.reset(); ScParameterClassification::Exit(); |