sw/source/core/text/porfld.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit e006c6ce7502f47889034b98cb0795e78ea36094
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Apr 5 13:53:19 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Apr 5 16:30:15 2023 +0200

    sw: fix the other stale SwNumberPortion follow flag
    
    This happens since commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd
    on abi13630-1.abw.
    
    itrpaint.cxx:419: void SwTextPainter::DrawTextLine: Assertion 
`roTaggedLabel' failed.
    
    The problem is very similar to the situation fixed with commit
    6c0105307efa15837e9e5287103995312f373b67; then it was the pField which
    ended up empty and deleted, while now it is "this" which ends up empty
    and deleted; in either case the DrawTextLine checks of the follow flags
    fail because some follow flag is erroneously set.
    
    This requires a further tweak because the length of the portion is set
    to 1, so Compress() returns the wrong result there but immediately after
    SwFieldPortion::Format() returns SwNumberPortion::Format() sets the
    length to 0 anyway, so simply set m_nFieldLen to 0 in ctor which is
    correct anyway as there's no dummy char for these.
    
    Change-Id: Ie99f67ee19a1f6019afe68764ec746cdc862984e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150055
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 04612aac0440..c26bc9596585 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -419,7 +419,11 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
             {
                 pField->SetFont( std::make_unique<SwFont>( *rInf.GetFont() ) );
             }
-            pField->SetFollow( true );
+            if (Compress())
+            {   // empty this will be deleted in SwLineLayout::CalcLine()
+                // anyway so make sure pField doesn't have a stale flag
+                pField->SetFollow( true );
+            }
             if (pField->Compress())
             {   // empty pField will be deleted in SwLineLayout::CalcLine()
                 // anyway so make sure this one doesn't have a stale flag
@@ -524,10 +528,10 @@ SwNumberPortion::SwNumberPortion( const OUString &rExpand,
                                   const bool bCntr,
                                   const sal_uInt16 nMinDst,
                                   const bool 
bLabelAlignmentPosAndSpaceModeActive )
-        : SwFieldPortion( rExpand, std::move(pFont) ),
-          m_nFixWidth(0),
-          m_nMinDist( nMinDst ),
-          mbLabelAlignmentPosAndSpaceModeActive( 
bLabelAlignmentPosAndSpaceModeActive )
+    : SwFieldPortion(rExpand, std::move(pFont), false, TextFrameIndex(0))
+    , m_nFixWidth(0)
+    , m_nMinDist(nMinDst)
+    , 
mbLabelAlignmentPosAndSpaceModeActive(bLabelAlignmentPosAndSpaceModeActive)
 {
     SetWhichPor( PortionType::Number );
     SetLeft( bLft );

Reply via email to