summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-08-31 17:57:26 +0200
committerCaolán McNamara <caolanm@redhat.com>2020-09-01 09:53:05 +0200
commitdfa0a910aa6ec26956d713d8265cac53b1904462 (patch)
tree9e016192d27bcb77aa9ea2029147fb8bd7833bdf /sw/source
parent921021b5d208fef12854bcf878489b1c05cde136 (diff)
tdf#135056 sw_redlinehide: when moving sections to undo nodes-array,
... delete frames with utmost prejudice - the code that was checking for empty frames or cells was going into infinite loop because first the *outer* section is moved to the undo nodes array, then when the *inner* (index header) section is moved, its section node's m_pStartOfSection points to the section node that is already in undo nodes array and so SwNodes::GoPrevSection() goes very wrong and CheckNodesRange() is called with positions in 2 different arrays. (regression from a60dd9ef1361c5925803acaa5292e99277d1faf3) Change-Id: I5682ebc2081ffc7dc49a9c43e613f72c26e93673 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101755 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 1d6e919046ed353a9d9d86bb9f0332da2e9dea4d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101682 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/docnode/ndsect.cxx3
-rw-r--r--sw/source/core/docnode/nodes.cxx7
2 files changed, 8 insertions, 2 deletions
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 67dea3850311..eeac5d109f8c 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1159,7 +1159,7 @@ void SwSectionNode::MakeOwnFrames(SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx)
}
}
-void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/)
+void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const bForce)
{
sal_uLong nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
if( nStt >= nEnd )
@@ -1176,6 +1176,7 @@ void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/)
// If the Area is within a Fly or TableBox, we can only hide it if
// there is more Content which has Frames.
// Or else the Fly/TableBox Frame does not have a Lower!
+ if (!bForce)
{
SwNodeIndex aIdx( *this );
if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 0a7207545381..01febcc78d40 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -634,7 +634,12 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
SwSectionNode* pSctNd = pSttNd->GetSectionNode();
if( bNewFrames && pSctNd )
- pSctNd->DelFrames();
+ { // tdf#135056 skip over code in DelFrames() that moves
+ // SwNodeIndex around because in case of nested
+ // sections, m_pStartOfSection will point between
+ // undo nodes-array and doc nodes-array
+ pSctNd->DelFrames(nullptr, true);
+ }
RemoveNode( aRg.aEnd.GetIndex(), 1, false ); // delete EndNode
sal_uLong nSttPos = pSttNd->GetIndex();