diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-11 17:11:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-12 08:57:55 +0200 |
commit | 20f82636df96836a58633a315fc73d8081612da8 (patch) | |
tree | d796c59423bccd013dbb670eb0e5be91223da04c /sc | |
parent | e51621d23d333c6d5d0279f5da30fcfd16d5ef9b (diff) |
use unique_ptr for ScAutoFormat in ScGlobal
Change-Id: I6d19eac2f1accd97eef32ab47667476cae71ab7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100558
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 | 21 |
2 files changed, 11 insertions, 12 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index bc576c9528ff..f22a6ea2f7fa 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -503,7 +503,7 @@ namespace utl { class ScGlobal { static std::unique_ptr<SvxSearchItem> xSearchItem; - static ScAutoFormat* pAutoFormat; + static std::unique_ptr<ScAutoFormat> xAutoFormat; static std::atomic<LegacyFuncCollection*> pLegacyFuncCollection; static std::atomic<ScUnoAddInCollection*> pAddInCollection; static std::unique_ptr<ScUserList> xUserList; diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index f8b87ba369ae..3d0ce48eb4c4 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -73,7 +73,7 @@ tools::SvRef<ScDocShell> ScGlobal::xDrawClipDocShellRef; std::unique_ptr<SvxSearchItem> ScGlobal::xSearchItem; -ScAutoFormat* ScGlobal::pAutoFormat = nullptr; +std::unique_ptr<ScAutoFormat> ScGlobal::xAutoFormat; std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr); std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr); std::unique_ptr<ScUserList> ScGlobal::xUserList; @@ -235,32 +235,31 @@ void ScGlobal::SetSearchItem( const SvxSearchItem& rNew ) void ScGlobal::ClearAutoFormat() { assert(!bThreadedGroupCalcInProgress); - if (pAutoFormat) + if (xAutoFormat) { // When modified via StarOne then only the SaveLater flag is set and no saving is done. // If the flag is set then save now. - if (pAutoFormat->IsSaveLater()) - pAutoFormat->Save(); - delete pAutoFormat; - pAutoFormat = nullptr; + if (xAutoFormat->IsSaveLater()) + xAutoFormat->Save(); + xAutoFormat.reset(); } } ScAutoFormat* ScGlobal::GetAutoFormat() { - return pAutoFormat; + return xAutoFormat.get(); } ScAutoFormat* ScGlobal::GetOrCreateAutoFormat() { assert(!bThreadedGroupCalcInProgress); - if ( !pAutoFormat ) + if ( !xAutoFormat ) { - pAutoFormat = new ScAutoFormat; - pAutoFormat->Load(); + xAutoFormat.reset(new ScAutoFormat); + xAutoFormat->Load(); } - return pAutoFormat; + return xAutoFormat.get(); } LegacyFuncCollection* ScGlobal::GetLegacyFuncCollection() |