sw/source/core/access/accpara.cxx | 20 ++++++++------------ sw/source/core/access/accpara.hxx | 6 +++--- 2 files changed, 11 insertions(+), 15 deletions(-)
New commits: commit a9c78d7849b62fde34ec79c50063fba550c05e70 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Mar 20 09:17:57 2018 +0200 loplugin:useuniqueptr in SwAccessibleParagraph Change-Id: I2648add548c214f7d448941db39622ca660f6fab Reviewed-on: https://gerrit.libreoffice.org/51665 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index beb170862692..ecc08ddac942 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -557,9 +557,9 @@ SwAccessibleParagraph::~SwAccessibleParagraph() { SolarMutexGuard aGuard; - delete m_pPortionData; - delete m_pHyperTextData; - delete mpParaChangeTrackInfo; // #i108125# + m_pPortionData.reset(); + m_pHyperTextData.reset(); + mpParaChangeTrackInfo.reset(); // #i108125# EndListeningAll(); } @@ -577,9 +577,8 @@ void SwAccessibleParagraph::UpdatePortionData() const SwTextFrame* pFrame = static_cast<const SwTextFrame*>( GetFrame() ); // build new portion data - delete m_pPortionData; - m_pPortionData = new SwAccessiblePortionData( - pFrame->GetTextNode(), GetMap()->GetShell()->GetViewOptions() ); + m_pPortionData.reset( new SwAccessiblePortionData( + pFrame->GetTextNode(), GetMap()->GetShell()->GetViewOptions() ) ); pFrame->VisitPortions( *m_pPortionData ); OSL_ENSURE( m_pPortionData != nullptr, "UpdatePortionData() failed" ); @@ -587,11 +586,8 @@ void SwAccessibleParagraph::UpdatePortionData() void SwAccessibleParagraph::ClearPortionData() { - delete m_pPortionData; - m_pPortionData = nullptr; - - delete m_pHyperTextData; - m_pHyperTextData = nullptr; + m_pPortionData.reset(); + m_pHyperTextData.reset(); } void SwAccessibleParagraph::ExecuteAtViewShell( sal_uInt16 nSlot ) @@ -3057,7 +3053,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL if( pHt ) { if( !m_pHyperTextData ) - m_pHyperTextData = new SwAccessibleHyperTextData; + m_pHyperTextData.reset( new SwAccessibleHyperTextData ); SwAccessibleHyperTextData::iterator aIter = m_pHyperTextData ->find( pHt ); if( aIter != m_pHyperTextData->end() ) diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx index c96001afb2b8..3179edacd458 100644 --- a/sw/source/core/access/accpara.hxx +++ b/sw/source/core/access/accpara.hxx @@ -73,8 +73,8 @@ class SwAccessibleParagraph : // string. // pPortionData may be NULL; it should only be accessed through the // Get/Clear/Has/UpdatePortionData() methods - SwAccessiblePortionData* m_pPortionData; - SwAccessibleHyperTextData *m_pHyperTextData; + std::unique_ptr<SwAccessiblePortionData> m_pPortionData; + std::unique_ptr<SwAccessibleHyperTextData> m_pHyperTextData; sal_Int32 m_nOldCaretPos; // The 'old' caret pos. It's only valid as long // as the cursor is inside this object (protected by @@ -86,7 +86,7 @@ class SwAccessibleParagraph : // implementation for XAccessibleSelection SwAccessibleSelectionHelper m_aSelectionHelper; - SwParaChangeTrackingInfo* mpParaChangeTrackInfo; // #i108125# + std::unique_ptr<SwParaChangeTrackingInfo> mpParaChangeTrackInfo; // #i108125# /// get the SwTextNode (requires frame; check before) const SwTextNode* GetTextNode() const; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits