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@collabora.co.uk>
This commit is contained in:
@@ -502,7 +502,7 @@ namespace utl {
|
|||||||
|
|
||||||
class ScGlobal
|
class ScGlobal
|
||||||
{
|
{
|
||||||
static SvxSearchItem* pSearchItem;
|
static std::unique_ptr<SvxSearchItem> xSearchItem;
|
||||||
static ScAutoFormat* pAutoFormat;
|
static ScAutoFormat* pAutoFormat;
|
||||||
static std::atomic<LegacyFuncCollection*> pLegacyFuncCollection;
|
static std::atomic<LegacyFuncCollection*> pLegacyFuncCollection;
|
||||||
static std::atomic<ScUnoAddInCollection*> pAddInCollection;
|
static std::atomic<ScUnoAddInCollection*> pAddInCollection;
|
||||||
|
@@ -72,7 +72,7 @@
|
|||||||
#include <docsh.hxx>
|
#include <docsh.hxx>
|
||||||
|
|
||||||
tools::SvRef<ScDocShell> ScGlobal::xDrawClipDocShellRef;
|
tools::SvRef<ScDocShell> ScGlobal::xDrawClipDocShellRef;
|
||||||
SvxSearchItem* ScGlobal::pSearchItem = nullptr;
|
std::unique_ptr<SvxSearchItem> ScGlobal::xSearchItem;
|
||||||
ScAutoFormat* ScGlobal::pAutoFormat = nullptr;
|
ScAutoFormat* ScGlobal::pAutoFormat = nullptr;
|
||||||
std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr);
|
std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr);
|
||||||
std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr);
|
std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr);
|
||||||
@@ -214,23 +214,22 @@ bool ScGlobal::CheckWidthInvalidate( bool& bNumFormatChanged,
|
|||||||
const SvxSearchItem& ScGlobal::GetSearchItem()
|
const SvxSearchItem& ScGlobal::GetSearchItem()
|
||||||
{
|
{
|
||||||
assert(!bThreadedGroupCalcInProgress);
|
assert(!bThreadedGroupCalcInProgress);
|
||||||
if (!pSearchItem)
|
if (!xSearchItem)
|
||||||
{
|
{
|
||||||
pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
|
xSearchItem.reset(new SvxSearchItem( SID_SEARCH_ITEM ));
|
||||||
pSearchItem->SetAppFlag( SvxSearchApp::CALC );
|
xSearchItem->SetAppFlag( SvxSearchApp::CALC );
|
||||||
}
|
}
|
||||||
return *pSearchItem;
|
return *xSearchItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScGlobal::SetSearchItem( const SvxSearchItem& rNew )
|
void ScGlobal::SetSearchItem( const SvxSearchItem& rNew )
|
||||||
{
|
{
|
||||||
assert(!bThreadedGroupCalcInProgress);
|
assert(!bThreadedGroupCalcInProgress);
|
||||||
// FIXME: An assignment operator would be nice here
|
// FIXME: An assignment operator would be nice here
|
||||||
delete pSearchItem;
|
xSearchItem.reset(rNew.Clone());
|
||||||
pSearchItem = rNew.Clone();
|
|
||||||
|
|
||||||
pSearchItem->SetWhich( SID_SEARCH_ITEM );
|
xSearchItem->SetWhich( SID_SEARCH_ITEM );
|
||||||
pSearchItem->SetAppFlag( SvxSearchApp::CALC );
|
xSearchItem->SetAppFlag( SvxSearchApp::CALC );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScGlobal::ClearAutoFormat()
|
void ScGlobal::ClearAutoFormat()
|
||||||
@@ -529,7 +528,7 @@ void ScGlobal::Clear()
|
|||||||
theAddInAsyncTbl.clear();
|
theAddInAsyncTbl.clear();
|
||||||
ExitExternalFunc();
|
ExitExternalFunc();
|
||||||
ClearAutoFormat();
|
ClearAutoFormat();
|
||||||
DELETEZ(pSearchItem);
|
xSearchItem.reset();
|
||||||
delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr;
|
delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr;
|
||||||
delete pAddInCollection.load(); pAddInCollection = nullptr;
|
delete pAddInCollection.load(); pAddInCollection = nullptr;
|
||||||
xUserList.reset();
|
xUserList.reset();
|
||||||
|
Reference in New Issue
Block a user