sw/source/core/doc/DocumentContentOperationsManager.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 6319847c3ec3facea6aaeaf065337f2592511b67
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Tue Jul 28 19:03:24 2020 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jul 30 21:25:01 2020 +0200

    tdf#134250 sw_redlinehide: fix copy non-empty node before non-textnode
    
    The problem in CopyImplImpl() is that pCopyPam's end position was
    updated to index 0 but text was copied into the node, which is thus not
    covered by pCopyPam and thus also not by SwUndoInserts.
    
    Then SwUndoInserts::UndoImpl() doesn't delete the bookmarks in the end
    node and the bookmark positions cause ~SwIndexReg asserts.
    
    Change-Id: I4cc03e846eae4cabd9eb4346a98c1e5c2866050d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99643
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>
    (cherry picked from commit 8ec8da5638ab465e69900a08067ad496bcb5d3d5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99771
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index f19c8f6c3e03..d8c2c0cd8796 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -5062,7 +5062,14 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
     if( rPos.nNode != aInsPos )
     {
         pCopyPam->GetMark()->nNode = aInsPos;
-        pCopyPam->GetMark()->nContent.Assign(pCopyPam->GetContentNode(false), 
0);
+        if (aInsPos < rPos.nNode)
+        {   // tdf#134250 decremented in (pEndTextNd && !pDestTextNd) above
+            
pCopyPam->GetContentNode(false)->MakeEndIndex(&pCopyPam->GetMark()->nContent);
+        }
+        else // incremented in (!pSttTextNd && pDestTextNd) above
+        {
+            
pCopyPam->GetMark()->nContent.Assign(pCopyPam->GetContentNode(false), 0);
+        }
         rPos = *pCopyPam->GetMark();
     }
     else
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to