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

loplugin:useuniqueptr in SwNodes

Change-Id: If2b317cbafca62c111938840754c6211f60ff898
Reviewed-on: https://gerrit.libreoffice.org/52344Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 75c166d0
......@@ -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. */
......
......@@ -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
......
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