[Libreoffice-commits] core.git: 2 commits - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 9 17:05:51 UTC 2019


 sw/source/core/docnode/node.cxx |   20 ++++++++++++++++++--
 sw/source/core/inc/txtfrm.hxx   |    2 --
 sw/source/core/text/txtfrm.cxx  |    7 ++++---
 3 files changed, 22 insertions(+), 7 deletions(-)

New commits:
commit 72fa40d6c91e5a02127b30575cc75604787cd972
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 9 16:45:17 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 9 19:04:49 2019 +0200

    sw: remove unnecessary boost include
    
    Change-Id: I38698992ee829ab1055e6f1da0f61ce35164a92f
    Reviewed-on: https://gerrit.libreoffice.org/77213
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index b34cd90f901d..26ba49dbb351 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -23,8 +23,6 @@
 #include "cntfrm.hxx"
 #include "TextFrameIndex.hxx"
 
-#include <boost/version.hpp>
-
 #include <set>
 
 namespace com { namespace sun { namespace star { namespace linguistic2 { class XHyphenatedWord; } } } }
commit b86ff2c6a88aa41379e74f11e8ec8497ff85ffd0
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 9 16:41:19 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 9 19:04:42 2019 +0200

    tdf#118699 sw_redlinehide: need some more changes to use the last node
    
    ... as property node for the merged frame.
    
    This would assert in SwContentNode::DelFrames() during tdf#126627
    and also in crashtesting, e.g. fdo66302-1.odt.
    
    (regression from fa5eb82b398e29ae033f7b7c8c8195dfc10cf5b0)
    
    Change-Id: Ia6d52287ed42f41d16ebf12bc61d7f4a6d7c5b03
    Reviewed-on: https://gerrit.libreoffice.org/77212
    Tested-by: Jenkins
    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 db564aeec12f..206fcdaf1f0a 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1371,8 +1371,24 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
                     // because that would access deleted wrong-lists
                     sw::UpdateMergedParaForDelete(*pMerged, true,
                             *static_cast<SwTextNode*>(this), 0, Len());
-                    // pointer should have been updated to a different node
-                    assert(this != pMerged->pParaPropsNode);
+                    if (this == pMerged->pParaPropsNode)
+                    {
+                        // otherwise pointer should have been updated to a different node
+                        assert(this == pMerged->pLastNode);
+                        assert(pMerged->extents.empty());
+                        for (sal_uLong i = pMerged->pLastNode->GetIndex() - 1;;
+                                --i)
+                        {
+                            assert(pMerged->pFirstNode->GetIndex() <= i);
+                            SwNode *const pNode(GetNodes()[i]);
+                            if (pNode->IsTextNode()
+                                && pNode->GetRedlineMergeFlag() != Merge::Hidden)
+                            {
+                                pMerged->pParaPropsNode = pNode->GetTextNode();
+                                break;
+                            }
+                        }
+                    }
                     if (this == pMerged->pLastNode)
                     {
                         pMerged->pLastNode = GetNodes()[GetIndex()-1]->GetTextNode();
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index a2f62d324e3b..a6264530a96b 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1014,8 +1014,9 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged,
         rMerged.extents.emplace(itInsert, const_cast<SwTextNode*>(&rNode), nIndex, nIndex + nLen);
         text.insert(nTFIndex, rNode.GetText().copy(nIndex, nLen));
         nInserted = nLen;
-        if (rNode.GetIndex() < rMerged.pParaPropsNode->GetIndex())
-        {   // text inserted before current para-props node
+        if (rMerged.extents.size() == 1 // also if it was empty!
+            || rMerged.pParaPropsNode->GetIndex() < rNode.GetIndex())
+        {   // text inserted after current para-props node
             rMerged.pParaPropsNode->RemoveFromListRLHidden();
             rMerged.pParaPropsNode = &const_cast<SwTextNode&>(rNode);
             rMerged.pParaPropsNode->AddToListRLHidden();
@@ -1147,7 +1148,7 @@ TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
         {
             rMerged.pParaPropsNode->RemoveFromListRLHidden();
             rMerged.pParaPropsNode = rMerged.extents.empty()
-                ? rMerged.pFirstNode
+                ? const_cast<SwTextNode*>(rMerged.pLastNode)
                 : rMerged.extents.front().pNode;
             rMerged.pParaPropsNode->AddToListRLHidden();
         }


More information about the Libreoffice-commits mailing list