[Libreoffice-commits] core.git: sc/inc sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 12 06:58:24 UTC 2020
sc/inc/global.hxx | 2 +-
sc/source/core/data/global.cxx | 19 +++++++++----------
2 files changed, 10 insertions(+), 11 deletions(-)
New commits:
commit e51621d23d333c6d5d0279f5da30fcfd16d5ef9b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 11 17:08:27 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 12 08:57:37 2020 +0200
use unique_ptr for SvxSearchItem in ScGlobal
Change-Id: I45f5d2bb699ef8cc6f32995bf15c2bf9095704fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100557
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 31c26e8f2db9..bc576c9528ff 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -502,7 +502,7 @@ namespace utl {
class ScGlobal
{
- static SvxSearchItem* pSearchItem;
+ static std::unique_ptr<SvxSearchItem> xSearchItem;
static ScAutoFormat* pAutoFormat;
static std::atomic<LegacyFuncCollection*> pLegacyFuncCollection;
static std::atomic<ScUnoAddInCollection*> pAddInCollection;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 02697c0eb84b..f8b87ba369ae 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -72,7 +72,7 @@
#include <docsh.hxx>
tools::SvRef<ScDocShell> ScGlobal::xDrawClipDocShellRef;
-SvxSearchItem* ScGlobal::pSearchItem = nullptr;
+std::unique_ptr<SvxSearchItem> ScGlobal::xSearchItem;
ScAutoFormat* ScGlobal::pAutoFormat = nullptr;
std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr);
std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr);
@@ -214,23 +214,22 @@ bool ScGlobal::CheckWidthInvalidate( bool& bNumFormatChanged,
const SvxSearchItem& ScGlobal::GetSearchItem()
{
assert(!bThreadedGroupCalcInProgress);
- if (!pSearchItem)
+ if (!xSearchItem)
{
- pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
- pSearchItem->SetAppFlag( SvxSearchApp::CALC );
+ xSearchItem.reset(new SvxSearchItem( SID_SEARCH_ITEM ));
+ xSearchItem->SetAppFlag( SvxSearchApp::CALC );
}
- return *pSearchItem;
+ return *xSearchItem;
}
void ScGlobal::SetSearchItem( const SvxSearchItem& rNew )
{
assert(!bThreadedGroupCalcInProgress);
// FIXME: An assignment operator would be nice here
- delete pSearchItem;
- pSearchItem = rNew.Clone();
+ xSearchItem.reset(rNew.Clone());
- pSearchItem->SetWhich( SID_SEARCH_ITEM );
- pSearchItem->SetAppFlag( SvxSearchApp::CALC );
+ xSearchItem->SetWhich( SID_SEARCH_ITEM );
+ xSearchItem->SetAppFlag( SvxSearchApp::CALC );
}
void ScGlobal::ClearAutoFormat()
@@ -529,7 +528,7 @@ void ScGlobal::Clear()
theAddInAsyncTbl.clear();
ExitExternalFunc();
ClearAutoFormat();
- DELETEZ(pSearchItem);
+ xSearchItem.reset();
delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr;
delete pAddInCollection.load(); pAddInCollection = nullptr;
xUserList.reset();
More information about the Libreoffice-commits
mailing list