From 6da4e626d17a9434d5d806bac6b7bbad23218df4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 3 Apr 2018 15:03:21 +0200 Subject: loplugin:useuniqueptr in SwContentNode Change-Id: I32dd7e43e3ca040c1d2b8c3bdf57141dd192ffab Reviewed-on: https://gerrit.libreoffice.org/52345 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/inc/node.hxx | 2 +- sw/source/core/docnode/node.cxx | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index e16b797f641d..27078a918be4 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -350,7 +350,7 @@ class SW_DLLPUBLIC SwContentNode: public SwModify, public SwNode, public SwIndex { //FEATURE::CONDCOLL - SwDepend* m_pCondColl; + std::unique_ptr m_pCondColl; //FEATURE::CONDCOLL mutable bool mbSetModifyAtAttr; diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 3db76343d687..112d06e28173 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1012,7 +1012,7 @@ SwContentNode::~SwContentNode() // Thus, we need to delete all Frames in the dependency list. DelFrames(false); - delete m_pCondColl; + m_pCondColl.reset(); if ( mpAttrSet.get() && mbSetModifyAtAttr ) const_cast(static_cast(mpAttrSet.get()))->SetModifyAtAttr( nullptr ); @@ -1762,11 +1762,9 @@ void SwContentNode::SetCondFormatColl( SwFormatColl* pColl ) ( pColl && pColl != m_pCondColl->GetRegisteredIn() ) ) { SwFormatColl* pOldColl = GetCondFormatColl(); - delete m_pCondColl; + m_pCondColl.reset(); if( pColl ) - m_pCondColl = new SwDepend( this, pColl ); - else - m_pCondColl = nullptr; + m_pCondColl.reset(new SwDepend( this, pColl )); if( GetpSwAttrSet() ) { -- cgit