Kaydet (Commit) 35ba29e0 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SpellChecker

Change-Id: I36a9fe01e228f3f2f5e441c369291da4c461f735
Reviewed-on: https://gerrit.libreoffice.org/49874Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst cc85db4c
......@@ -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();
}
}
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment