sw/inc/node.hxx                   |    2 +-
 sw/source/core/docnode/ndsect.cxx |    3 ++-
 sw/source/core/docnode/nodes.cxx  |    7 ++++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 1d6e919046ed353a9d9d86bb9f0332da2e9dea4d
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Mon Aug 31 17:57:26 2020 +0200
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Tue Sep 1 08:15:53 2020 +0200

    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.st...@cib.de>

diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index af48d95d5ec2..6f1fa1bae68f 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 7865ae68e33f..524aef0d3d1e 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 14a93715772e..5be7ba5cf9cf 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -636,7 +636,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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to