sw/source/core/doc/tblcpy.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
New commits: commit ee5b332e34962b79ecd24e9fd111d307aabcbf7d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Mar 28 11:03:22 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Mar 28 12:06:28 2019 +0100 use unique_ptr in SwTable::InsTable Change-Id: I02ad6fb65e39ed14fd1aff2df876a9704c0d8f3b Reviewed-on: https://gerrit.libreoffice.org/69882 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 7d56989b5735..43e06fce73e2 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -800,7 +800,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, SwTableNumFormatMerge aTNFM( *pCpyDoc, *pDoc ); - FndLine_ *pFLine, *pInsFLine = nullptr; + FndLine_ *pFLine; FndBox_ aFndBox( nullptr, nullptr ); // Find all Boxes/Lines { @@ -887,11 +887,12 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, SwTableLine* pLine = pFLine->GetLine(); SwTableBox* pSttBox = pFLine->GetBoxes()[0]->GetBox(); const SwTableBoxes::size_type nSttBox = pLine->GetBoxPos( pSttBox ); + std::unique_ptr<FndLine_> pInsFLine; if( nLn >= nFndCnt ) { // We have more rows in the ClipBoard than we have selected - pInsFLine = new FndLine_( GetTabLines()[ nSttLine + nLn ], - &aFndBox ); + pInsFLine.reset(new FndLine_( GetTabLines()[ nSttLine + nLn ], + &aFndBox )); pLine = pInsFLine->GetLine(); } SwTableLine* pCpyLn = rCpyTable.GetTabLines()[ nLn % @@ -904,7 +905,6 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, if( pLine->GetTabBoxes().size() < nSttBox || pLine->GetTabBoxes().size() - nSttBox < pFLine->GetBoxes().size() ) { - delete pInsFLine; return false; } @@ -914,15 +914,14 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, SwTableBox *pTmpBox = pLine->GetTabBoxes()[ nSttBox + nBx ]; if( !pTmpBox->GetSttNd() ) { - delete pInsFLine; return false; } // if Ok, insert the Box into the FndLine - pFndBox = new FndBox_( pTmpBox, pInsFLine ); + pFndBox = new FndBox_( pTmpBox, pInsFLine.get() ); pInsFLine->GetBoxes().insert( pInsFLine->GetBoxes().begin() + nBx, std::unique_ptr<FndBox_>(pFndBox)); } - aFndBox.GetLines().insert( aFndBox.GetLines().begin() + nLn, std::unique_ptr<FndLine_>(pInsFLine)); + aFndBox.GetLines().insert( aFndBox.GetLines().begin() + nLn, std::move(pInsFLine)); } else if( pFLine->GetBoxes().size() == 1 ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits