summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-06 10:49:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-17 07:06:49 +0100
commit35ba29e093d41ce88a827ab145ba8df09ff0ee2f (patch)
tree70f8ece45b13e9f9cb012ed3818bd6abfb7ddb13 /lingucomponent
parentcc85db4c4e2ca9ef8e1c9fc0af6d314767678faa (diff)
loplugin:useuniqueptr in SpellChecker
Change-Id: I36a9fe01e228f3f2f5e441c369291da4c461f735 Reviewed-on: https://gerrit.libreoffice.org/49874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx9
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.hxx2
2 files changed, 4 insertions, 7 deletions
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 12b9e240fa24..db6c183a8cef 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -72,7 +72,6 @@ using namespace linguistic;
SpellChecker::SpellChecker() :
m_aEvtListeners(GetLinguMutex()),
- m_pPropHelper(nullptr),
m_bDisposing(false)
{
}
@@ -87,7 +86,6 @@ SpellChecker::~SpellChecker()
if (m_pPropHelper)
{
m_pPropHelper->RemoveAsPropListener();
- delete m_pPropHelper;
}
}
@@ -97,7 +95,7 @@ PropertyHelper_Spelling & SpellChecker::GetPropHelper_Impl()
{
Reference< XLinguProperties > xPropSet( GetLinguProperties(), UNO_QUERY );
- m_pPropHelper = new PropertyHelper_Spelling( static_cast<XSpellChecker *>(this), xPropSet );
+ m_pPropHelper.reset( new PropertyHelper_Spelling( static_cast<XSpellChecker *>(this), xPropSet ) );
m_pPropHelper->AddAsPropListener(); //! after a reference is established
}
return *m_pPropHelper;
@@ -577,7 +575,7 @@ void SAL_CALL SpellChecker::initialize( const Sequence< Any >& rArguments )
//! And the reference to the UNO-functions while increasing
//! the ref-count and will implicitly free the memory
//! when the object is no longer used.
- m_pPropHelper = new PropertyHelper_Spelling( static_cast<XSpellChecker *>(this), xPropSet );
+ m_pPropHelper.reset( new PropertyHelper_Spelling( static_cast<XSpellChecker *>(this), xPropSet ) );
m_pPropHelper->AddAsPropListener(); //! after a reference is established
}
else {
@@ -598,8 +596,7 @@ void SAL_CALL SpellChecker::dispose()
if (m_pPropHelper)
{
m_pPropHelper->RemoveAsPropListener();
- delete m_pPropHelper;
- m_pPropHelper = nullptr;
+ m_pPropHelper.reset();
}
}
}
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
index d8e5581463da..82ddbedf0af3 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
@@ -69,7 +69,7 @@ class SpellChecker :
Sequence< Locale > m_aSuppLocales;
::comphelper::OInterfaceContainerHelper2 m_aEvtListeners;
- linguistic::PropertyHelper_Spelling* m_pPropHelper;
+ std::unique_ptr<linguistic::PropertyHelper_Spelling> m_pPropHelper;
bool m_bDisposing;
SpellChecker(const SpellChecker &) = delete;