summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-03 14:55:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-04 09:32:02 +0200
commitfd6c82b3e1669cf696cb97c139b436a8df2547c5 (patch)
tree72a3f6abb91f16a3554fc47c2ce580649c6f3ad9 /sw
parent75c166d058717a7edd26273f50a86fe5f2cc7fb0 (diff)
loplugin:useuniqueptr in SwNodes
Change-Id: If2b317cbafca62c111938840754c6211f60ff898 Reviewed-on: https://gerrit.libreoffice.org/52344 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/ndarr.hxx6
-rw-r--r--sw/source/core/docnode/nodes.cxx12
2 files changed, 9 insertions, 9 deletions
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