summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-08-17 10:43:04 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-08-18 10:55:21 +0200
commitafb52ce707679c2fe6f2dbdef2670b1d34f45604 (patch)
treefa3e50c818a6c89b2766f14c009f31ca1988a3d5
parenttdf#150452: Revert "tdf#130795 use concurrent hashmap in SharedStringPool" (diff)
downloadcore-afb52ce707679c2fe6f2dbdef2670b1d34f45604.tar.gz
core-afb52ce707679c2fe6f2dbdef2670b1d34f45604.zip
tdf#147466 sw_redlinehide: avoid crashing by delete un-deleting
After the first delete, there is a single redline from 170,0 to 177,9, which contains a section. [ 169] 0x6133358 TextNode "b) 9 (Robin Cook, Jack Straw, Margaret Beckett, David Milliband, William Hague, Philip Hammond, Boris Johnson, Jeremy Hunt, Dominic Raab)", [ 170] 0x61349d8 TextNode "Hangul script is used to write which language?", [ 171] 0x61396f0 SectionNode , [ 172] 0x6138cc8 TextNode "Japanese", [ 173] 0x613ab58 TextNode "Vietnamese", [ 174] 0x613ad78 TextNode "Korean", [ 175] 0x613bc28 TextNode "Chinese", [ 176] 0x24a61c0 EndNode , [ 177] 0x6139568 TextNode "c) Korean", Then the next delete is from 169,137 to 170,0 and it is combined in AppendRedline() with the existing one, removing the existing one. Now the code for tdf#119571 at the end of AppendRedline() that splits up the one redline into 4 redlines, with the section start node and section end node not covered by any of them. AppendRedline() of a delete redline causing previously deleted nodes to become un-deleted is a situation that UpdateFramesForAddDeleteRedline() doesn't expect. Additionally there seems to be an issue with CheckParaRedlineMerge() setting the Section's m_bHiddenFlag, which was unintentional, it should only set m_eMerge flag, but fixing that isn't sufficient. Reportedly this crashes since commit 6433dc223f6d21570e7132c4a580d186a5d5a334 but the problem appears older. Change-Id: Ic83a93d5aaec4ee562fb960693b52bd7b25cb1a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138411 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 7d730cd580e957ab06b0c7f020ac37dd0c337aa2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138417 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx7
-rw-r--r--sw/source/core/text/redlnitr.cxx2
2 files changed, 7 insertions, 2 deletions
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 8a9a70ae2bb9..5052e320f216 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1666,8 +1666,13 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
pNewRedl->SetEnd( *pRStt, pEnd );
break;
- case SwComparePosition::CollideStart:
case SwComparePosition::CollideEnd:
+ if (pRStt->nContent != 0)
+ { // tdf#147466 HACK: don't combine in this case to avoid the tdf#119571 code from *undeleting* section nodes
+ break;
+ }
+ [[fallthrough]];
+ case SwComparePosition::CollideStart:
if( pRedl->IsOwnRedline( *pNewRedl ) &&
pRedl->CanCombine( *pNewRedl ) )
{
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 3613469d7703..5b1e30c47018 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -425,7 +425,7 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
}
for (auto const pSectionNode : sections)
{
- pSectionNode->DelFrames(rFrame.getRootFrame());
+ pSectionNode->GetSection().GetFormat()->DelFrames(/*rFrame.getRootFrame()*/);
}
}
auto pRet(std::make_unique<sw::MergedPara>(rFrame, std::move(extents),