From 7042d52b0789c8311f8f007862aa80dba54e72f1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 20 Jun 2018 15:48:46 +0200 Subject: loplugin:useuniqueptr in SvxLinguTabPage Change-Id: I98e683bd23e854507c37e4d88a42a4c249bf5c44 Reviewed-on: https://gerrit.libreoffice.org/56195 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/inc/optlingu.hxx | 2 +- cui/source/options/optlingu.cxx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'cui') diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx index 04ca33441cde..25a8d47646d2 100644 --- a/cui/source/inc/optlingu.hxx +++ b/cui/source/inc/optlingu.hxx @@ -129,7 +129,7 @@ private: std::unique_ptr m_xCheckButtonData; - SvxLinguData_Impl* pLinguData; + std::unique_ptr pLinguData; SvxLinguTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet ); SvTreeListEntry* CreateEntry(OUString& rTxt, sal_uInt16 nCol); diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 6ee8ea97aa67..fc02af9c258a 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -1029,8 +1029,7 @@ SvxLinguTabPage::~SvxLinguTabPage() void SvxLinguTabPage::dispose() { - delete pLinguData; - pLinguData = nullptr; + pLinguData.reset(); m_pLinguModulesFT.clear(); m_pLinguModulesCLB.clear(); m_pLinguModulesEditPB.clear(); @@ -1060,7 +1059,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet ) { DBG_ASSERT( pLinguData, "pLinguData not yet initialized" ); if (!pLinguData) - pLinguData = new SvxLinguData_Impl; + pLinguData.reset( new SvxLinguData_Impl ); // update spellchecker configuration entries const LangImplNameTable *pTable = &pLinguData->GetSpellTable(); @@ -1299,7 +1298,7 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet ) if (m_pLinguModulesCLB->IsVisible()) { if (!pLinguData) - pLinguData = new SvxLinguData_Impl; + pLinguData.reset( new SvxLinguData_Impl ); UpdateModulesBox_Impl(); } @@ -1459,7 +1458,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void ) if (m_pLinguModulesEditPB == pBtn) { if (!pLinguData) - pLinguData = new SvxLinguData_Impl; + pLinguData.reset( new SvxLinguData_Impl ); SvxLinguData_Impl aOldLinguData( *pLinguData ); ScopedVclPtrInstance< SvxEditModulesDlg > aDlg( this, *pLinguData ); -- cgit