[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 7 08:50:50 UTC 2020


 sw/source/core/docnode/node.cxx  |    2 ++
 sw/source/core/text/redlnitr.cxx |    3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit b6624e578120a117a7ff828a4a0e58fab9d4be6f
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Apr 2 18:59:40 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Apr 7 10:50:18 2020 +0200

    (related: tdf#130685) sw_redlinehide: fix update of pLastNode/pParaPropsNode
    
    If you Select All, Cut then move the cursor around a bit then paste, then this happens:
    
    sw/source/core/text/txtfrm.cxx:3461: void SwTextFrame::CalcAdditionalFirstLineOffset(): Assertion `pTextNode->IsNumbered(getRootFrame()) == pTextNode->IsNumbered(nullptr)' failed.
    
    The reason is this borked MergedPara, which really only has 1 node it's listening on, but pLastNode and pParaPropsNode point to a node that is actually part of a different MergedPara now.
    
    $6 = {
      listener = {
        m_rToTell = @0x6c02700,
        m_vDepends = std::__debug::vector of length 1, capacity 256 = {{
            <SwClient> = {
              m_pRegisteredIn = 0x6af5f20
            },
          }}
      },
      extents = std::__debug::vector of length 0, capacity 0,
      mergedText = "",
      pParaPropsNode = 0x6d1c390,
      pFirstNode = 0x6af5f20,
      pLastNode = 0x6d1c390
    }
    
    The reason is that SwContentNode::DelFrames() doesn't update these members properly; at the time when it's called for the previous pLastNode, the offending node has Merge::NonFirst set already in the call of CheckParaRedlineMerge() so it sets the wrong new pLastNode.
    
    Fix this by iterating DelFrames() loop backward.
    
    (regression from sw_redlinehide)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91597
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 520b0e1679d7a97aa3d91cfc95ca647339da7e84)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91524
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit f8d0f77de20d6adf6f532d13003a96856a98f69b)
    
    Change-Id: I508fd25af385a25ba9ed78d71aa3d1f02a7ac7a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91761
    Tested-by: Michael Stahl <michael.stahl at cib.de>
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 56986583b9d5..ff124e45b789 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1370,6 +1370,7 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
                             *static_cast<SwTextNode*>(this), 0, Len());
                     // pointer should have been updated to a different node
                     assert(this != pMerged->pParaPropsNode);
+                    assert(pMerged->listener.IsListeningTo(pMerged->pParaPropsNode));
                     assert(GetIndex() <= pMerged->pLastNode->GetIndex());
                     if (this == pMerged->pLastNode)
                     {
@@ -1390,6 +1391,7 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
                             }
                         }
                         assert(pMerged->pFirstNode->GetIndex() <= pMerged->pLastNode->GetIndex());
+                        assert(pMerged->listener.IsListeningTo(pMerged->pLastNode));
                     }
                     // avoid re-parenting mess (ModifyChangedHint)
                     pMerged->listener.EndListening(this);
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index db13203cb7a6..27321ecebf09 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -274,7 +274,8 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
         }
         // unfortunately DelFrames() must be done before StartListening too,
         // otherwise footnotes cannot be deleted by SwTextFootnote::DelFrames!
-        for (auto iter = ++nodes.begin(); iter != nodes.end(); ++iter)
+        auto const end(--nodes.rend());
+        for (auto iter = nodes.rbegin(); iter != end; ++iter)
         {
             (**iter).DelFrames(rFrame.getRootFrame());
         }


More information about the Libreoffice-commits mailing list