sw/inc/node.hxx | 2 +- sw/source/core/doc/docdesc.cxx | 7 +++---- sw/source/core/docnode/node.cxx | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-)
New commits: commit 47faab780f2a099715a95ce6f3c5228f0fe0c599 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 9 10:13:54 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jan 9 11:11:36 2019 +0100 use unique_ptr in SwContentNode::CreateOLENodesArray Change-Id: I4ff33dbdc4d87fd00e4a2b995fff1238c7e2a679 Reviewed-on: https://gerrit.libreoffice.org/65995 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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 ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits