[Libreoffice-commits] core.git: sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 3 08:14:19 UTC 2018
sc/source/filter/html/htmlpars.cxx | 15 +++++----------
sc/source/filter/inc/htmlpars.hxx | 6 +++---
2 files changed, 8 insertions(+), 13 deletions(-)
New commits:
commit 071d14324c2c5c85ed8fe7a0e8bb2ae77d1538f9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 2 16:46:47 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 3 10:13:55 2018 +0200
tdf#119007 Crash when paste table from web
regression from
commit 510033783a9921eef507d424fc5adf6e2696bc4a
loplugin:useuniqueptr in ScHTMLLayoutParser
Change-Id: I3c6f04ac2c8f188856ec4c9eb6bf520fa03ee97a
Reviewed-on: https://gerrit.libreoffice.org/58480
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 788c851a5732..09d042e1b18e 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -226,12 +226,7 @@ ScHTMLLayoutParser::ScHTMLLayoutParser(
ScHTMLLayoutParser::~ScHTMLLayoutParser()
{
while ( !aTableStack.empty() )
- {
- ScHTMLTableStackEntry* pS = aTableStack.top().get();
- if ( pS->pLocalColOffset != pLocalColOffset.get() )
- delete pS->pLocalColOffset;
aTableStack.pop();
- }
pLocalColOffset.reset();
if ( pTables )
{
@@ -1032,7 +1027,7 @@ void ScHTMLLayoutParser::TableOn( HtmlImportInfo* pInfo )
sal_uInt16 nTmpColOffset = nColOffset; // Will be changed in Colonize()
Colonize(mxActEntry.get());
aTableStack.push( o3tl::make_unique<ScHTMLTableStackEntry>(
- mxActEntry, xLockedList, pLocalColOffset.get(), nFirstTableCell,
+ mxActEntry, xLockedList, std::move(pLocalColOffset), nFirstTableCell,
nRowCnt, nColCntStart, nMaxCol, nTable,
nTableWidth, nColOffset, nColOffsetStart,
bFirstRow ) );
@@ -1088,7 +1083,7 @@ void ScHTMLLayoutParser::TableOn( HtmlImportInfo* pInfo )
NextRow( pInfo );
}
aTableStack.push( o3tl::make_unique<ScHTMLTableStackEntry>(
- mxActEntry, xLockedList, pLocalColOffset.get(), nFirstTableCell,
+ mxActEntry, xLockedList, std::move(pLocalColOffset), nFirstTableCell,
nRowCnt, nColCntStart, nMaxCol, nTable,
nTableWidth, nColOffset, nColOffsetStart,
bFirstRow ) );
@@ -1238,7 +1233,7 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo )
{
sal_uInt16 nOldOffset = pE->nOffset + pE->nWidth;
sal_uInt16 nNewOffset = pE->nOffset + nTableWidth;
- ModifyOffset( pS->pLocalColOffset, nOldOffset, nNewOffset, nOffsetTolerance );
+ ModifyOffset( pS->pLocalColOffset.get(), nOldOffset, nNewOffset, nOffsetTolerance );
sal_uInt16 nTmp = nNewOffset - pE->nOffset - pE->nWidth;
pE->nWidth = nNewOffset - pE->nOffset;
pS->nTableWidth = pS->nTableWidth + nTmp;
@@ -1257,7 +1252,7 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo )
nColOffsetStart = pS->nColOffsetStart;
bFirstRow = pS->bFirstRow;
xLockedList = pS->xLockedList;
- pLocalColOffset.reset( pS->pLocalColOffset );
+ pLocalColOffset = std::move( pS->pLocalColOffset );
// mxActEntry is kept around if a table is started in the same row
// (anything's possible in HTML); will be deleted by CloseEntry
mxActEntry = pE;
@@ -1274,7 +1269,7 @@ void ScHTMLLayoutParser::TableOff( const HtmlImportInfo* pInfo )
{
std::unique_ptr<ScHTMLTableStackEntry> pS = std::move(aTableStack.top());
aTableStack.pop();
- pLocalColOffset.reset( pS->pLocalColOffset );
+ pLocalColOffset = std::move( pS->pLocalColOffset );
}
}
}
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index bac9257f9d5d..2518e68631d2 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -99,7 +99,7 @@ struct ScHTMLTableStackEntry
{
ScRangeListRef xLockedList;
std::shared_ptr<ScEEParseEntry> xCellEntry;
- ScHTMLColOffset* pLocalColOffset;
+ std::unique_ptr<ScHTMLColOffset> pLocalColOffset;
sal_uLong nFirstTableCell;
SCROW nRowCnt;
SCCOL nColCntStart;
@@ -110,14 +110,14 @@ struct ScHTMLTableStackEntry
sal_uInt16 nColOffsetStart;
bool bFirstRow;
ScHTMLTableStackEntry( const std::shared_ptr<ScEEParseEntry>& rE,
- const ScRangeListRef& rL, ScHTMLColOffset* pTO,
+ const ScRangeListRef& rL, std::unique_ptr<ScHTMLColOffset> pTO,
sal_uLong nFTC,
SCROW nRow,
SCCOL nStart, SCCOL nMax, sal_uInt16 nTab,
sal_uInt16 nTW, sal_uInt16 nCO, sal_uInt16 nCOS,
bool bFR )
: xLockedList( rL ), xCellEntry(rE),
- pLocalColOffset( pTO ),
+ pLocalColOffset( std::move(pTO) ),
nFirstTableCell( nFTC ),
nRowCnt( nRow ),
nColCntStart( nStart ), nMaxCol( nMax ),
More information about the Libreoffice-commits
mailing list