diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-11 14:26:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-13 08:34:03 +0000 |
commit | a706bb06d5326e7a997dd1d71f3f947bd0ad28e6 (patch) | |
tree | 8ac34dea4e7e4106d3adbccc6a604b611928ffbe /sw/source/core/layout/layouter.cxx | |
parent | 8c73acd101c80a4479f25e35278a451dc3c4b22e (diff) |
new loplugin: useuniqueptr: sw part 1
Change-Id: I2bc55634e80976951ede768c97fbc4b7c4eda46c
Reviewed-on: https://gerrit.libreoffice.org/32963
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/layout/layouter.cxx')
-rw-r--r-- | sw/source/core/layout/layouter.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx index 638d0e76056c..8e455c5894ab 100644 --- a/sw/source/core/layout/layouter.cxx +++ b/sw/source/core/layout/layouter.cxx @@ -45,13 +45,13 @@ public: class SwEndnoter { - SwLayouter* pMaster; - SwSectionFrame* pSect; - SwFootnoteFrames* pEndArr; + SwLayouter* pMaster; + SwSectionFrame* pSect; + std::unique_ptr<SwFootnoteFrames> pEndArr; public: explicit SwEndnoter( SwLayouter* pLay ) - : pMaster( pLay ), pSect( nullptr ), pEndArr( nullptr ) {} - ~SwEndnoter() { delete pEndArr; } + : pMaster( pLay ), pSect( nullptr ) {} + ~SwEndnoter() {} void CollectEndnotes( SwSectionFrame* pSct ); void CollectEndnote( SwFootnoteFrame* pFootnote ); const SwSectionFrame* GetSect() const { return pSect; } @@ -114,7 +114,7 @@ void SwEndnoter::CollectEndnote( SwFootnoteFrame* pFootnote ) } } if( !pEndArr ) - pEndArr = new SwFootnoteFrames; // deleted from the SwLayouter + pEndArr.reset( new SwFootnoteFrames ); // deleted from the SwLayouter pEndArr->push_back( pFootnote ); } @@ -133,8 +133,7 @@ void SwEndnoter::InsertEndnotes() SwFootnoteBossFrame *pBoss = pRef ? pRef->FindFootnoteBossFrame() : static_cast<SwFootnoteBossFrame*>(pSect->Lower()); pBoss->MoveFootnotes_( *pEndArr ); - delete pEndArr; - pEndArr = nullptr; + pEndArr.reset(); pSect = nullptr; } |