sw/source/core/text/itrform2.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit ed5adb367ed0070d06312bce3ec3f44ec87a2361
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Apr 20 19:21:08 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Apr 21 10:55:17 2023 +0200

    sw: fix crashtesting assert on fdo44018-2.doc
    
    itrpaint.cxx:435: void SwTextPainter::DrawTextLine(): Assertion 
`!roTaggedParagraph' failed.
    
    The problem is that there are in fact 3 lines with the numbering bullet,
    which is a problem that existed since LO 4.1, but that only changed the
    WW8 import so it really exists all the way back to OOo 3.0.1.
    
    The SwNumberingPortion is created, then it is cloned for the insertion
    of the tab, then the 2nd one is deleted (which is expected as it is
    empty), then due to some ChkFlyUnderflow() SwTextFormatter::FormatLine()
    resets the m_bNumDone flag and the next line gets another numbering.
    
    The m_bNumDone flag must be reset if the numbering portion was deleted,
    but not otherwise.
    
    (regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd)
    
    Change-Id: I575947fdfb8786ad6d0f9e83636c39eb929a1b06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150709
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index f4cbe364ebe6..f2c130ac4194 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1980,7 +1980,15 @@ TextFrameIndex 
SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
                      || GetInfo().CheckFootnotePortion(m_pCurr);
             if( bBuild )
             {
-                GetInfo().SetNumDone( bOldNumDone );
+                // fdo44018-2.doc: only restore m_bNumDone if a 
SwNumberPortion will be truncated
+                for (SwLinePortion * pPor = m_pCurr->GetNextPortion(); pPor; 
pPor = pPor->GetNextPortion())
+                {
+                    if (pPor->InNumberGrp())
+                    {
+                        GetInfo().SetNumDone( bOldNumDone );
+                        break;
+                    }
+                }
                 GetInfo().ResetMaxWidthDiff();
 
                 // delete old rest

Reply via email to