summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-07-22 13:24:15 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-07-27 11:14:40 +0200
commit632cc0507353c8a85e7438d6ef082bafb2a2137a (patch)
tree77bc6841fcd66a7cd67f632581cf2727cd685bda
parent721120ff44ef619b032003374109b6db447ab327 (diff)
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@cib.de>
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx41
1 files changed, 28 insertions, 13 deletions
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;