Bug 147409

Summary: Assertion for Fontwork > Same Letter Height
Product: LibreOffice Reporter: Heiko Tietze <heiko.tietze>
Component: WriterAssignee: Regina Henschel <rb.henschel>
Status: VERIFIED FIXED    
Severity: normal CC: rb.henschel
Priority: medium Keywords: bibisectRequest, regression
Version: 7.4.0.0 alpha0+   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=146866
Whiteboard: target:7.4.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 107634    
Attachments: Call Stack by VS2019

Description Heiko Tietze 2022-02-14 10:44:13 UTC
Pressing the button results in

svl/source/items/itempool.cxx:679: virtual const SfxPoolItem& SfxItemPool::PutImpl(const SfxPoolItem&, sal_uInt16, bool): Assertion `(!IsItemPoolable(nWhich) || rItem == *pNewItem) && "SfxItemPool::Put(): unequal items: no operator== override?"' failed.

happens in FontworkBar::execute() case SID_FONTWORK_SAME_LETTER_HEIGHTS: at pObj->SetMergedItem( aGeometryItem );

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 23f1d0436f4a23b496c271c86325b8e336d60f3b
CPU threads: 8; OS: Linux 5.16; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (en_US.UTF-8); UI: en-US
Calc: threaded

(No issue with 7.3.0.3)
Comment 1 Regina Henschel 2022-02-14 13:35:14 UTC
Created attachment 178266 [details]
Call Stack by VS2019
Comment 2 Regina Henschel 2022-02-14 13:36:00 UTC
Assertion fails too in my build Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: a34c2af04592ca4c0d5247ec80f593c23f905d54
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 3 Regina Henschel 2022-02-14 16:56:26 UTC
@Heiko, can you please test bug 146866. The assertion fails similar for me there, but Dieter could not reproduce it.
Comment 4 Heiko Tietze 2022-02-15 05:26:42 UTC
(In reply to Regina Henschel from comment #3)
> @Heiko, can you please test bug 146866. The assertion fails similar for me
> there, but Dieter could not reproduce it.

Confirmed your ticket. Didn't run with debugger to check if the crash happens on the same function.
Comment 5 Regina Henschel 2022-02-16 18:47:01 UTC
Both have a wrong construction for the toggle:

css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "SameLetterHeights" );
if( pAny )
{
    bool bOn = false;
   (*pAny) >>= bOn;
    bOn = !bOn;
   (*pAny) <<= bOn;
}

Making the change into the target of pAny changes the rGeometryItem, but does not trigger InvalidateHash(). So the rGeometryItem has still aHashState "Valid", but the hash was not recalculated and therefore it is wrong.

Instead a Set-method of rGeometryItem has to be used. Something like

css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "SameLetterHeights" );
if( pAny )
{
     bool bOn = false;
     (*pAny) >>= bOn;
     bOn = !bOn;
     css::beans::PropertyValue aPropValue;
     aPropValue.Name = "SameLetterHeights";
     aPropValue.Value <<= bOn;
     rGeometryItem.SetPropertyValue("TextPath", aPropValue);
}

I'll make a patch, but after https://gerrit.libreoffice.org/c/core/+/124337 is submitted. Otherwise it might generate a merge conflict.
Comment 6 Commit Notification 2022-02-17 22:57:14 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4c0b033ece143b6f398157e812ff1c6b22e2855d

tdf#147409 tdf#146866 use SetPropertyValue for toggle

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Heiko Tietze 2022-02-18 08:31:16 UTC
Thanks, Regina!