summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-11 21:24:05 +0000
committerAndras Timar <andras.timar@collabora.com>2018-04-07 13:19:52 +0200
commitdbb64d979abe3e7fbb3e9b52156274dbdec2af78 (patch)
tree989159990e5cc136e511fb9cae961a7e4e7c8412
parent0c43c330159b9214fff2efe6d7a9c15e9f93adb4 (diff)
ofz#6827 drop last anchor pos if it will be joined
Change-Id: Ib36b74b455f741d9dcccbdf244d21453837bda3c Reviewed-on: https://gerrit.libreoffice.org/51100 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit f79c3fbd8a9c4e89346e042cc31397bd6e277e09)
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index b24434aebd4f..2596354df817 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2370,6 +2370,21 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
if (bStealAttr)
m_pCtrlStck->StealAttr(rPam.GetPoint()->nNode);
+ if (m_pLastAnchorPos.get())
+ {
+ //If the last anchor pos is here, then clear the anchor pos.
+ //This "last anchor pos" is only used for fixing up the
+ //positions of things anchored to page breaks and here
+ //we are removing the last paragraph of a frame, so there
+ //cannot be a page break at this point so we can
+ //safely reset m_pLastAnchorPos to avoid any dangling
+ //SwIndex's pointing into the deleted paragraph
+ SwNodeIndex aLastAnchorPos(m_pLastAnchorPos->nNode);
+ SwNodeIndex aToBeJoined(aPref, 1);
+ if (aLastAnchorPos == aToBeJoined)
+ m_pLastAnchorPos.reset();
+ }
+
pNode->JoinNext();
bRet = true;