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

New commits:
commit 632cc0507353c8a85e7438d6ef082bafb2a2137a
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Wed Jul 22 13:24:15 2020 +0200
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Mon Jul 27 11:14:40 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.st...@cib.de>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 6bce5c1d9364..c0e1aa6add8c 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1445,7 +1445,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 );
@@ -1454,8 +1462,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
                                 n = 0;      // re-initialize
                                 bDec = true;
                             }
-                            else
-                                pNewRedl->SetEnd( *pRStt, pEnd );
                         }
                         break;
 
@@ -1724,7 +1730,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 );
@@ -1891,20 +1903,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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to