diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-09 10:13:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-09 11:11:36 +0100 |
commit | 47faab780f2a099715a95ce6f3c5228f0fe0c599 (patch) | |
tree | b37ad2a4b8464c055acc018a37bcf69dcf77af3a /sw | |
parent | 8addcffd4c4b1ce8d7e4c8dee01c312b68f1de71 (diff) |
use unique_ptr in SwContentNode::CreateOLENodesArray
Change-Id: I4ff33dbdc4d87fd00e4a2b995fff1238c7e2a679
Reviewed-on: https://gerrit.libreoffice.org/65995
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/node.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/docnode/node.cxx | 6 |
3 files changed, 7 insertions, 8 deletions
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index 8f817d0b12bd..7f585b8617bd 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -467,7 +467,7 @@ public: void SetModifyAtAttr( bool bSetModifyAtAttr ) const { mbSetModifyAtAttr = bSetModifyAtAttr; } bool GetModifyAtAttr() const { return mbSetModifyAtAttr; } - static SwOLENodes* CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize ); + static std::unique_ptr<SwOLENodes> CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize ); // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index da6df6321fc3..0cfc0efb98bd 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -725,7 +725,7 @@ void SwDoc::PrtOLENotify( bool bAll ) mbOLEPrtNotifyPending = mbAllOLENotify = false; - SwOLENodes *pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll ); + std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll ); if ( pNodes ) { ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY, @@ -768,7 +768,7 @@ void SwDoc::PrtOLENotify( bool bAll ) pGlobalOLEExcludeList->push_back( aName ); } } - delete pNodes; + pNodes.reset(); getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction(); ::EndProgress( GetDocShell() ); } @@ -782,7 +782,7 @@ IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void ) { mbOLEPrtNotifyPending = mbAllOLENotify = false; - SwOLENodes *pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true ); + std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true ); if( pNodes ) { ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY, @@ -806,7 +806,6 @@ IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void ) } getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction(); ::EndProgress( GetDocShell() ); - delete pNodes; } } } diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 5fe4e056c442..2ef8b3400a85 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -2010,9 +2010,9 @@ SvxFrameDirection SwContentNode::GetTextDirection( const SwPosition& rPos, return nRet; } -SwOLENodes* SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize ) +std::unique_ptr<SwOLENodes> SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize ) { - SwOLENodes *pNodes = nullptr; + std::unique_ptr<SwOLENodes> pNodes; SwIterator<SwContentNode,SwFormatColl> aIter( rColl ); for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() ) { @@ -2020,7 +2020,7 @@ SwOLENodes* SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) ) { if ( !pNodes ) - pNodes = new SwOLENodes; + pNodes.reset(new SwOLENodes); pNodes->push_back( pONd ); } } |