sw/inc/ndarr.hxx | 6 +++--- sw/source/core/docnode/nodes.cxx | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-)
New commits: commit fd6c82b3e1669cf696cb97c139b436a8df2547c5 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Apr 3 14:55:23 2018 +0200 loplugin:useuniqueptr in SwNodes Change-Id: If2b317cbafca62c111938840754c6211f60ff898 Reviewed-on: https://gerrit.libreoffice.org/52344 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index cd0a3f02397d..2ab4d146005d 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -107,10 +107,10 @@ class SW_DLLPUBLIC SwNodes final SwDoc* m_pMyDoc; ///< This Doc contains the nodes-array. SwNode *m_pEndOfPostIts, *m_pEndOfInserts, ///< These are the fixed ranges. - *m_pEndOfAutotext, *m_pEndOfRedlines, - *m_pEndOfContent; + *m_pEndOfAutotext, *m_pEndOfRedlines; + std::unique_ptr<SwNode> m_pEndOfContent; - mutable SwOutlineNodes* m_pOutlineNodes; ///< Array of all outline nodes. + mutable std::unique_ptr<SwOutlineNodes> m_pOutlineNodes; ///< Array of all outline nodes. bool m_bInNodesDel : 1; /**< In Case of recursive calling. Do not update Num/Outline. */ diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 510cbd938e33..19e42cc5488d 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -81,9 +81,9 @@ SwNodes::SwNodes( SwDoc* pDocument ) pTmp = new SwStartNode( *this, nPos++ ); pTmp->m_pStartOfSection = pSttNd; - m_pEndOfContent = new SwEndNode( *this, nPos++, *pTmp ); + m_pEndOfContent.reset(new SwEndNode( *this, nPos++, *pTmp )); - m_pOutlineNodes = new SwOutlineNodes; + m_pOutlineNodes.reset(new SwOutlineNodes); } /** Destructor @@ -94,14 +94,14 @@ SwNodes::SwNodes( SwDoc* pDocument ) */ SwNodes::~SwNodes() { - delete m_pOutlineNodes; + m_pOutlineNodes.reset(); { SwNodeIndex aNdIdx( *this ); while( true ) { SwNode *pNode = &aNdIdx.GetNode(); - if( pNode == m_pEndOfContent ) + if( pNode == m_pEndOfContent.get() ) break; ++aNdIdx; @@ -110,7 +110,7 @@ SwNodes::~SwNodes() } // here, all SwNodeIndices must be unregistered - delete m_pEndOfContent; + m_pEndOfContent.reset(); } void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz, @@ -1356,7 +1356,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt ) { // The whole nodes array will be destroyed, you're in the Doc's DTOR! // The initial start/end nodes should be only destroyed in the SwNodes' DTOR! - SwNode* aEndNdArr[] = { m_pEndOfContent, + SwNode* aEndNdArr[] = { m_pEndOfContent.get(), m_pEndOfPostIts, m_pEndOfInserts, m_pEndOfAutotext, m_pEndOfRedlines, nullptr _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits