summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-10-06 19:22:51 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-10-07 20:27:39 +0200
commit0fb5f7e22b68fc045843af95ca3918c1d92a8656 (patch)
treebdd43d2aada58a1eb90dc1c2ef42094818b15b70 /sw
parentc5d32e7a9a58e1643f1ef10bb24de40c58ab0edc (diff)
tdf#150500 sw_fieldmarkhide: fix duplicate text frame on paste
The problem is that in MakeFrames() after the 1st iteration the SwNode2Layout::NextFrame() on node 10 returns a SwTextFrame that was just created by the 1st iteration, due to a fieldmark merging the 2 SwTextNodes. Only itreate the frames that are pre-existing. (regression from commit 2f726fa41cbd249f2fb30222b29d5f30bce52e6e) Change-Id: Iba684dfc903e1c72ca3e70a9aabf1aecf4baf32b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141032 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 21358e0502995238b85677d72a005f3f96d60f7f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141059 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/frmtool.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index ee50dcc7cd12..ecd69e9012ab 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2026,9 +2026,14 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
{
bool bApres = aTmp < rSttIdx;
SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() );
- SwFrame* pFrame;
sw::FrameMode eMode = sw::FrameMode::Existing;
- while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
+ ::std::vector<SwFrame*> frames;
+ while (SwFrame* pFrame = aNode2Layout.NextFrame())
+ { // tdf#150500 new frames may be created that end up merged on pNd
+ // so copy the currently existing ones; they shouldn't get deleted
+ frames.push_back(pFrame);
+ }
+ for (SwFrame *const pFrame : frames)
{
SwLayoutFrame *pUpper = pFrame->GetUpper();
SwFootnoteFrame* pFootnoteFrame = pUpper->FindFootnoteFrame();