diff options
author | Michael Stahl <mstahl@redhat.com> | 2018-02-19 11:28:40 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2018-02-20 10:23:53 +0100 |
commit | 76d5b9d0cf0b0f1f15205b06a26399425e2a345e (patch) | |
tree | eaca68577c66aacd002539db7c79d9c877be4dc7 /sw/source | |
parent | 665e646c3b217e93c8e0649a4fa4326340163483 (diff) |
sw: convert DELETEZ to unique_ptr in SwTextNode
Change-Id: I0df469be660c20513f82b465412ffcf31b0a0f63
Reviewed-on: https://gerrit.libreoffice.org/49990
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index a442be331735..c9c5bbfb579a 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -198,7 +198,6 @@ SwTextNode *SwNodes::MakeTextNode( const SwNodeIndex & rWhere, SwTextNode::SwTextNode( const SwNodeIndex &rWhere, SwTextFormatColl *pTextColl, const SfxItemSet* pAutoAttr ) : SwContentNode( rWhere, SwNodeType::Text, pTextColl ), - m_pSwpHints( nullptr ), mpNodeNum( nullptr ), m_Text(), m_pParaIdleData_Impl(nullptr), @@ -244,8 +243,7 @@ SwTextNode::~SwTextNode() if ( m_pSwpHints ) { // do not delete attributes twice when those delete their content - SwpHints* pTmpHints = m_pSwpHints; - m_pSwpHints = nullptr; + std::unique_ptr<SwpHints> pTmpHints(std::move(m_pSwpHints)); for( size_t j = pTmpHints->Count(); j; ) { @@ -253,8 +251,6 @@ SwTextNode::~SwTextNode() // if would delete itself DestroyAttr( pTmpHints->Get( --j ) ); } - - delete pTmpHints; } // must be removed from outline nodes by now @@ -445,8 +441,7 @@ SwContentNode *SwTextNode::SplitContentNode( const SwPosition &rPos ) { if ( pNode->m_pSwpHints->CanBeDeleted() ) { - delete pNode->m_pSwpHints; - pNode->m_pSwpHints = nullptr; + pNode->m_pSwpHints.reset(); } else { @@ -1398,7 +1393,7 @@ SwTextNode::GetTextAttrsAt(sal_Int32 const nIndex, sal_uInt16 const nWhich) cons { assert(nWhich >= RES_TXTATR_BEGIN && nWhich < RES_TXTATR_END); std::vector<SwTextAttr *> ret; - lcl_GetTextAttrs(& ret, nullptr, m_pSwpHints, nIndex, nWhich, DEFAULT); + lcl_GetTextAttrs(&ret, nullptr, m_pSwpHints.get(), nIndex, nWhich, DEFAULT); return ret; } @@ -1416,7 +1411,7 @@ SwTextNode::GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, // "GetTextAttrAt() will give wrong result for this hint!") SwTextAttr * pRet(nullptr); - lcl_GetTextAttrs(nullptr, & pRet, m_pSwpHints, nIndex, nWhich, eMode); + lcl_GetTextAttrs(nullptr, & pRet, m_pSwpHints.get(), nIndex, nWhich, eMode); return pRet; } |