use unique_ptr for ScGlobal::pEnglishFormatter

Change-Id: Ic570f78fadaa42efc3a61a414dbdec4dd52d3aed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100561
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-08-11 17:22:21 +02:00
parent 2ad735a957
commit b4c6ad8930
2 changed files with 8 additions and 8 deletions

View File

@@ -518,7 +518,7 @@ class ScGlobal
static std::atomic<ScUnitConverter*> pUnitConverter;
static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export
static std::unique_ptr<SvNumberFormatter> xEnglishFormatter; // for UNO / XML export
static css::uno::Reference< css::i18n::XOrdinalSuffix> xOrdinalSuffix;
static std::unique_ptr<CalendarWrapper> xCalendar;

View File

@@ -97,7 +97,7 @@ std::unique_ptr<ScFunctionList> ScGlobal::xStarCalcFunctionList;
std::unique_ptr<ScFunctionMgr> ScGlobal::xStarCalcFunctionMgr;
std::atomic<ScUnitConverter*> ScGlobal::pUnitConverter(nullptr);
SvNumberFormatter* ScGlobal::pEnglishFormatter = nullptr;
std::unique_ptr<SvNumberFormatter> ScGlobal::xEnglishFormatter;
ScFieldEditEngine* ScGlobal::pFieldEditEngine = nullptr;
double ScGlobal::nScreenPPTX = 96.0;
@@ -167,13 +167,13 @@ sal_uInt16 ScGlobal::GetStandardRowHeight()
SvNumberFormatter* ScGlobal::GetEnglishFormatter()
{
assert(!bThreadedGroupCalcInProgress);
if ( !pEnglishFormatter )
if ( !xEnglishFormatter )
{
pEnglishFormatter = new SvNumberFormatter(
::comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US );
pEnglishFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
xEnglishFormatter.reset( new SvNumberFormatter(
::comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US ) );
xEnglishFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
}
return pEnglishFormatter;
return xEnglishFormatter.get();
}
bool ScGlobal::CheckWidthInvalidate( bool& bNumFormatChanged,
@@ -540,7 +540,7 @@ void ScGlobal::Clear()
xEmptyBrushItem.reset();
xButtonBrushItem.reset();
xEmbeddedBrushItem.reset();
DELETEZ(pEnglishFormatter);
xEnglishFormatter.reset();
delete pCaseTransliteration.load(); pCaseTransliteration = nullptr;
delete pTransliteration.load(); pTransliteration = nullptr;
delete pCaseCollator.load(); pCaseCollator = nullptr;