[Libreoffice-commits] core.git: sc/inc sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 12 06:58:45 UTC 2020
sc/inc/global.hxx | 2 +-
sc/source/core/data/global.cxx | 21 ++++++++++-----------
2 files changed, 11 insertions(+), 12 deletions(-)
New commits:
commit 20f82636df96836a58633a315fc73d8081612da8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 11 17:11:55 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 12 08:57:55 2020 +0200
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 at collabora.co.uk>
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()
More information about the Libreoffice-commits
mailing list