diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-07-26 10:58:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-07-26 18:54:47 +0200 |
commit | 96844af26402e4ab26ff7ba02e52989c3b294095 (patch) | |
tree | d33bb8f30c8bbb304a50ccbfe95600f39e07f252 /sw/source/filter/ww8/wrtw8nds.cxx | |
parent | 4e6327c673075ab4a44f497a06a8dbf759c1a72a (diff) |
elide some temporaries when constructing SwPosition
because the resulting pointer manipulation is not free, the temporary
has to be attached to a linked list and then immediately de-linked
Also add some asserts to catch SwPosition being created with
mis-matching nodes in the SwNodeIndex and SwContentIndex.
Which flushes out some bugs in
SwHTMLParser::NewDivision
SwIntrnlSectRefLink::DataChanged
where it was creating a SwPosition
with the SwNodeIndex and the SwContentIndex pointing at
different nodes.
Change-Id: Iea69f5ffc5860eb654435e161bc544b412d4c245
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137411
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8/wrtw8nds.cxx')
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index b7e9461e1574..7366750d894b 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -238,7 +238,7 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTextNode& rTextNd) : if ( !m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) { - SwPosition aPosition( m_rNode, SwContentIndex( &m_rNode ) ); + SwPosition aPosition( m_rNode ); m_pCurRedline = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedline( aPosition, &m_nCurRedlinePos ); } @@ -2489,7 +2489,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) IDocumentMarkAccess* const pMarkAccess = m_rDoc.getIDocumentMarkAccess(); if ( ch == CH_TXT_ATR_FIELDSTART ) { - SwPosition aPosition( rNode, SwContentIndex( &rNode, nCurrentPos ) ); + SwPosition aPosition( rNode, nCurrentPos ); ::sw::mark::IFieldmark const*const pFieldmark = pMarkAccess->getFieldmarkAt(aPosition); assert(pFieldmark); @@ -2541,7 +2541,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) } else if (ch == CH_TXT_ATR_FIELDSEP) { - SwPosition aPosition(rNode, SwContentIndex(&rNode, nCurrentPos)); + SwPosition aPosition(rNode, nCurrentPos); // the innermost field is the correct one ::sw::mark::IFieldmark const*const pFieldmark = pMarkAccess->getFieldmarkFor(aPosition); assert(pFieldmark); @@ -2567,7 +2567,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) } else if ( ch == CH_TXT_ATR_FIELDEND ) { - SwPosition aPosition( rNode, SwContentIndex( &rNode, nCurrentPos ) ); + SwPosition aPosition( rNode, nCurrentPos ); ::sw::mark::IFieldmark const*const pFieldmark = pMarkAccess->getFieldmarkAt(aPosition); assert(pFieldmark); @@ -2604,7 +2604,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) } else if ( ch == CH_TXT_ATR_FORMELEMENT ) { - SwPosition aPosition( rNode, SwContentIndex( &rNode, nCurrentPos ) ); + SwPosition aPosition( rNode, nCurrentPos ); ::sw::mark::IFieldmark const*const pFieldmark = pMarkAccess->getFieldmarkAt(aPosition); assert(pFieldmark); |