sc/inc/global.hxx | 2 +- sc/source/core/data/global.cxx | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
New commits: commit 6b7d8f4f5f7b4595b29f1ae00c2de4393265d307 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Aug 11 17:04:44 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 12 08:57:13 2020 +0200 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.gran...@collabora.co.uk> 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits