summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docredln.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-26 10:58:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-26 18:54:47 +0200
commit96844af26402e4ab26ff7ba02e52989c3b294095 (patch)
treed33bb8f30c8bbb304a50ccbfe95600f39e07f252 /sw/source/core/doc/docredln.cxx
parent4e6327c673075ab4a44f497a06a8dbf759c1a72a (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/core/doc/docredln.cxx')
-rw-r--r--sw/source/core/doc/docredln.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index e460c0ce3a68..acf28394c840 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1532,7 +1532,7 @@ void SwRangeRedline::MoveToSection()
SwTextNode* pTextNd = rNds[ pSttNd->GetIndex() + 1 ]->GetTextNode();
SwNodeIndex aNdIdx( *pTextNd );
- SwPosition aPos( aNdIdx, SwContentIndex( pTextNd ));
+ SwPosition aPos( *pTextNd );
if( pCSttNd && pCEndNd )
{
// tdf#140982 keep annotation ranges in deletions in margin mode
@@ -1599,9 +1599,7 @@ void SwRangeRedline::CopyToSection()
pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ),
SwNormalStartNode, pColl );
- SwNodeIndex aNdIdx( *pSttNd, 1 );
- SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode();
- SwPosition aPos( aNdIdx, SwContentIndex( pTextNd ));
+ SwPosition aPos( *pSttNd, SwNodeOffset(1) );
// tdf#115815 keep original start position of collapsed annotation ranges
// as temporary bookmarks (removed after file saving and file loading)