summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-08-31 17:57:26 +0200
committerAndras Timar <andras.timar@collabora.com>2020-09-09 11:57:58 +0200
commitb012d4105ab3e8390ebba7a1cea1ae78836da450 (patch)
tree5f0671db93d1a4ec0a134dcd2d216759b2a84666 /sw
parent12cb847c5006c7008bf77b48b18aecd720f4eb10 (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/+/101683 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/node.hxx2
-rw-r--r--sw/source/core/docnode/ndsect.cxx3
-rw-r--r--sw/source/core/docnode/nodes.cxx7
3 files changed, 9 insertions, 3 deletions
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 36ce909cb7cf..d12e06d3e950 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -551,7 +551,7 @@ public:
/** Method deletes all views of document for the node. The
content frames are removed from the respective layout. */
- void DelFrames(SwRootFrame const* pLayout = nullptr);
+ void DelFrames(SwRootFrame const* pLayout = nullptr, bool bForce = false);
/** Method creates all views of document for the previous node.
The content frames created are put into the respective layout. */
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 11c6237f5f15..8c2efee0eb7e 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1156,7 +1156,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 )
@@ -1173,6 +1173,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 10f4ba61be03..2a2bef4f4488 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();