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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 29 07:54:51 UTC 2020


 sw/source/core/doc/DocumentRedlineManager.cxx |   41 +++++++++++++++++---------
 1 file changed, 28 insertions(+), 13 deletions(-)

New commits:
commit 596148081c6d03b5582a5387c542dce5a8ec3df8
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jul 22 13:24:15 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Jul 29 09:45:00 2020 +0200

    sw: fix AppendRedline() creating empty redlines for Outside
    
    This happens on tdf#133967 bugdoc with the Delete/Delete case first, in
    line 1445 - the start positions are equal, so the new redline is empty
    => DocumentRedlineManager.cxx:92: redline table corrupted: empty redline
    
    Similar bugs exist for Delete/Insert case in line 1725 and Format/? case
    in line 1892, the latter even checks a nonsensical condition
    *pEnd != *pRStt that is always true for Outside case.
    
    It's like that since inital CVS import.
    
    Change-Id: I7ade25380a5a43b14e87db37da8fc84267e89dd2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99389
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 632cc0507353c8a85e7438d6ef082bafb2a2137a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99406
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index d23a69717f66..22c5d6b81b21 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1443,7 +1443,15 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                         {
                             // Overlaps the current one completely,
                             // split the new one
-                            if( *pEnd != *pREnd )
+                            if (*pEnd == *pREnd)
+                            {
+                                pNewRedl->SetEnd(*pRStt, pEnd);
+                            }
+                            else if (*pStt == *pRStt)
+                            {
+                                pNewRedl->SetStart(*pREnd, pStt);
+                            }
+                            else
                             {
                                 SwRangeRedline* pNew = new SwRangeRedline( *pNewRedl );
                                 pNew->SetStart( *pREnd );
@@ -1452,8 +1460,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                                 n = 0;      // re-initialize
                                 bDec = true;
                             }
-                            else
-                                pNewRedl->SetEnd( *pRStt, pEnd );
                         }
                         break;
 
@@ -1722,7 +1728,13 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                             {
                                 pRedl->PushData( *pNewRedl );
                                 if( *pEnd == *pREnd )
+                                {
                                     pNewRedl->SetEnd( *pRStt, pEnd );
+                                }
+                                else if (*pStt == *pRStt)
+                                {
+                                    pNewRedl->SetStart(*pREnd, pStt);
+                                }
                                 else
                                 {
                                     pNew = new SwRangeRedline( *pNewRedl );
@@ -1889,20 +1901,23 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
                     case SwComparePosition::Outside:
                         // Overlaps the current one completely,
                         // split or shorten the new one
-                        if( *pEnd != *pREnd )
+                        if (*pEnd == *pREnd)
                         {
-                            if( *pEnd != *pRStt )
-                            {
-                                SwRangeRedline* pNew = new SwRangeRedline( *pNewRedl );
-                                pNew->SetStart( *pREnd );
-                                pNewRedl->SetEnd( *pRStt, pEnd );
-                                AppendRedline( pNew, bCallDelete );
-                                n = 0;      // re-initialize
-                                bDec = true;
-                            }
+                            pNewRedl->SetEnd(*pRStt, pEnd);
+                        }
+                        else if (*pStt == *pRStt)
+                        {
+                            pNewRedl->SetStart(*pREnd, pStt);
                         }
                         else
+                        {
+                            SwRangeRedline* pNew = new SwRangeRedline( *pNewRedl );
+                            pNew->SetStart( *pREnd );
                             pNewRedl->SetEnd( *pRStt, pEnd );
+                            AppendRedline( pNew, bCallDelete );
+                            n = 0;      // re-initialize
+                            bDec = true;
+                        }
                         break;
                     default:
                         break;


More information about the Libreoffice-commits mailing list