From a59fc8cbd013ace88f0a462bf807e178a95cffd8 Mon Sep 17 00:00:00 2001 From: Xisco Fauli <anistenis@gmail.com> Date: Mon, 23 May 2016 01:59:45 +0200 Subject: tdf#89329: use unique_ptr for pImpl in SpellDialog Change-Id: Ic4231e2c20ec89c59b0bedd32cac6363b830442c Reviewed-on: https://gerrit.libreoffice.org/25329 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> --- cui/source/dialogs/SpellDialog.cxx | 7 +++---- cui/source/inc/SpellDialog.hxx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 4c72cf25acdf..439499f76f8d 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -182,6 +182,7 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, , bModified(false) , bFocusLocked(true) , rParent(*pChildWindow) + , pImpl( new SpellDialog_Impl ) { m_sTitleSpellingGrammar = GetText(); m_sTitleSpelling = get<FixedText>("alttitleft")->GetText(); @@ -224,7 +225,6 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, get(m_pToolbar, "toolbar"); m_pSentenceED->Init(m_pToolbar); xSpell = LinguMgr::GetSpellChecker(); - pImpl = new SpellDialog_Impl; const StyleSettings& rSettings = GetSettings().GetStyleSettings(); Color aCol = rSettings.GetHelpColor(); @@ -251,15 +251,14 @@ SpellDialog::~SpellDialog() void SpellDialog::dispose() { - if (pImpl) + if (pImpl.get()) { // save possibly modified user-dictionaries Reference< XSearchableDictionaryList > xDicList( SvxGetDictionaryList() ); if (xDicList.is()) SaveDictionaries( xDicList ); - delete pImpl; - pImpl = nullptr; + pImpl.reset(); } m_pLanguageFT.clear(); m_pLanguageLB.clear(); diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 595035d497d4..b166dd134a5f 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -175,7 +175,7 @@ private: svx::SpellDialogChildWindow& rParent; svx::SpellPortions m_aSavedSentence; - SpellDialog_Impl* pImpl; + std::unique_ptr<SpellDialog_Impl> pImpl; css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpell; -- cgit