[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/inc sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 3 07:25:08 UTC 2020


 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 48b796af1d1522119ff7749a63458b29f65f0885
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Aug 31 17:57:26 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu Sep 3 09:24:35 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.stahl at cib.de>
    (cherry picked from commit 1d6e919046ed353a9d9d86bb9f0332da2e9dea4d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101683
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

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();


More information about the Libreoffice-commits mailing list