Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert a Multi-Page Text/word file to PNG using LibreOffice API in JAVA #42

Closed
wants to merge 1 commit into from

Conversation

Madhupatel08
Copy link

How to convert a Multi-Page Text file to PNG, for example:- I have a Text document of 5 pages and I want to convert that into PNG. By default, it's giving a PNG of only 1st page. How to get the PNG file for ith page using LibreOffice.

I used the PageRange filter like this, but it does not work, it's also giving the PNG only for 1st page.

Also, I'm not able to generate multiple PNGs for multi-page word files using the LibreOffice Application

CLI:-

soffice --convert-to 'png:writer_png_Export:{"PageRange":{"type":"string","value":"2-"}}' test.odt

JAVA:-

conversionProperties[0] = new com.sun.star.beans.PropertyValue();
conversionProperties[0].Name = "FilterName";
conversionProperties[0].Value ="writer_png_Export";

conversionProperties[1] = new com.sun.star.beans.PropertyValue();
conversionProperties[1].Name = "PageRange";
conversionProperties[1].Value ="2-";

cc: @stbergmann @vmiklos @caolanm @mmohrhard

@github-actions
Copy link

Thank you for your contribution. We use GitHub as a read-only mirror, so please submit your patch into our own code review system: https://wiki.documentfoundation.org/Development/GetInvolved

@github-actions github-actions bot closed this Sep 25, 2023
wwjiang007 pushed a commit to wwjiang007/LibreOffice-core that referenced this pull request Oct 2, 2023
Don't just invalidate, but also dispose the a11y children
in `FrameSelectorImpl::~FrameSelectorImpl`.

This fixes a crash on exit that's reproducible with
the gtk3 VCL plugin e.g. like this (maybe some
steps aren't even needed):

1) start LO Writer with the gtk3 VCL plugin
2) right-click, select "Character" > "Character"
   in context menu
3) switch to "Font Effects" tab
4) press space key with focus in the font color combobox
   to open the popup
5) use Tab key to get to the view of colors
6) move around with arrow keys a bit
7) close the dialog and Writer

Reverse-continuing to `atk_object_wrapper_dispose`
(frame LibreOffice#10 in the below backtrace) in rr
showed the involved a11y object:

    uno::Reference to (svx::a11y::AccFrameSelectorChild *) 0x5557832b9150

Backtrace (somewhat similar to the one in tdf#156683):

    #0  0x00007ffff6b15cd6 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear(std::unique_lock<std::mutex>&, com::sun::star::lang::EventObject const&)
        (this=0x7fffffffca88, rGuard=..., rEvt=...) at .../include/comphelper/interfacecontainer4.hxx:397
    LibreOffice#1  0x00007ffff6b13c6f in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
        (_nClient=1058, _rxEventSource=uno::Reference to (svx::a11y::AccFrameSelectorChild *) 0x55555cecfdf0) at .../comphelper/source/misc/accessibleeventnotifier.cxx:204
    LibreOffice#2  0x00007ffff6b1028a in comphelper::OCommonAccessibleComponent::disposing() (this=0x55555cecfdf0) at .../comphelper/source/misc/accessiblecomponenthelper.cxx:61
    LibreOffice#3  0x00007ffff6674aeb in cppu::WeakComponentImplHelperBase::dispose() (this=0x55555cecfdf0) at .../cppuhelper/source/implbase.cxx:104
    LibreOffice#4  0x00007ffff2ddf0e0 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::dispose() (this=0x55555cecfdf0)
        at .../include/cppuhelper/compbase.hxx:90
    LibreOffice#5  0x00007ffff6674834 in cppu::WeakComponentImplHelperBase::release() (this=0x55555cecfdf0) at .../cppuhelper/source/implbase.cxx:79
    LibreOffice#6  0x00007ffff2ddf642 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/compbase.hxx:86
    LibreOffice#7  0x00007ffff2ddf378 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleComponent>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/implbase.hxx:171
    LibreOffice#8  0x00007ffff2ddf0a0 in cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper, com::sun::star::accessibility::XAccessible>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/implbase.hxx:171
    LibreOffice#9  0x00007fffe3f29535 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::clear() (this=0x55555d40a010) at .../include/com/sun/star/uno/Reference.hxx:231
    LibreOffice#10 0x00007fffe3f288de in atk_object_wrapper_dispose(AtkObjectWrapper*) (wrapper=0x55555d409fa0) at .../vcl/unx/gtk3/a11y/atkwrapper.cxx:1078
    LibreOffice#11 0x00007fffe3f27527 in atk_object_wrapper_finalize(GObject*) (obj=0x55555d409fa0) at .../vcl/unx/gtk3/a11y/atkwrapper.cxx:674
    LibreOffice#12 0x00007ffff138c48c in g_object_unref () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    LibreOffice#13 0x00007fffe3f003f7 in AtkListener::~AtkListener() (this=0x55555ce6ecb0, __in_chrg=<optimized out>) at .../vcl/unx/gtk3/a11y/atklistener.cxx:57
    LibreOffice#14 0x00007fffe3f0042e in AtkListener::~AtkListener() (this=0x55555ce6ecb0, __in_chrg=<optimized out>) at .../vcl/unx/gtk3/a11y/atklistener.cxx:58
    LibreOffice#15 0x00007ffff6756838 in cppu::OWeakObject::release() (this=0x55555ce6ecb0) at .../cppuhelper/source/weak.cxx:230
    LibreOffice#16 0x00007fffe3f0a7de in cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release() (this=0x55555ce6ecb0) at .../include/cppuhelper/implbase.hxx:115
    LibreOffice#17 0x00007ffff6b21b99 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>::~Reference() (this=0x55555d40a0c0, __in_chrg=<optimized out>)
        at .../include/com/sun/star/uno/Reference.hxx:114
    LibreOffice#18 0x00007ffff6b217a9 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__pointer=0x55555d40a0c0) at /usr/include/c++/13/bits/stl_construct.h:151
    LibreOffice#19 0x00007ffff6b20bcf in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55555d40a0c0, __last=0x55555d40a0c8) at /usr/include/c++/13/bits/stl_construct.h:163
    LibreOffice#20 0x00007ffff6b1f105 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55555d40a0c0, __last=0x55555d40a0c8) at /usr/include/c++/13/bits/stl_construct.h:196
    LibreOffice#21 0x00007ffff6b197aa in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >&) (__last=0x55555d40a0c8, __first=0x55555d40a0c0) at /usr/include/c++/13/bits/alloc_traits.h:947
    LibreOffice#22 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector()
        (this=0x55555cf22af8, __in_chrg=<optimized out>) at /usr/include/c++/13/bits/stl_vector.h:732
    LibreOffice#23 0x00007ffff6b17402 in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector() (this=0x55555cf22ae0, __in_chrg=<optimized out>) at /usr/include/c++/13/debug/vector:230
    LibreOffice#24 0x00007ffff6b1742a in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::impl_t::~impl_t() (this=0x55555cf22ae0, __in_chrg=<optimized out>) at .../include/o3tl/cow_wrapper.hxx:176
    LibreOffice#25 0x00007ffff6b17485 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::release() (this=0x55555d40a0b0) at .../include/o3tl/cow_wrapper.hxx:207
    LibreOffice#26 0x00007ffff6b15700 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::~cow_wrapper() (this=0x55555d40a0b0, __in_chrg=<optimized out>) at .../include/o3tl/cow_wrapper.hxx:271
    LibreOffice#27 0x00007ffff6b145b4 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::~OInterfaceContainerHelper4() (this=0x55555d40a0b0, __in_chrg=<optimized out>)
        at .../include/comphelper/interfacecontainer4.hxx:126
    LibreOffice#28 0x00007ffff6b206c6 in std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::~pair() (this=0x55555d40a0a8, __in_chrg=<optimized out>)
        at /usr/include/c++/13/bits/stl_pair.h:187
    LibreOffice#29 0x00007ffff6b1aac4 in std::__new_allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> >::destroy<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*) (__p=0x55555d40a0a8, this=0x7ffff6f64988 <(anonymous namespace)::gaClients+40>) at /usr/include/c++/13/bits/new_allocator.h:194
    LibreOffice#30 std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::destroy<std::pair<unsigned i--Type <RET> for more, q to quit, c to continue without paging--
    nt const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> >&, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*) (__p=0x55555d40a0a8, __a=...)
        at /usr/include/c++/13/bits/alloc_traits.h:557
    LibreOffice#31 std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7ffff6f64988 <(anonymous namespace)::gaClients+40>, __n=0x55555d40a0a0) at /usr/include/c++/13/bits/hashtable_policy.h:2020
    LibreOffice#32 0x00007ffff6b188b7 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7ffff6f64988 <(anonymous namespace)::gaClients+40>, __n=0x55555d409ef0) at /usr/include/c++/13/bits/hashtable_policy.h:2042
    LibreOffice#33 0x00007ffff6b164e6 in std::_Hashtable<unsigned int, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::clear() (this=0x7ffff6f64988 <(anonymous namespace)::gaClients+40>) at /usr/include/c++/13/bits/hashtable.h:2509
    LibreOffice#34 0x00007ffff6b187cc in std::__cxx1998::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7ffff6f64988 <(anonymous namespace)::gaClients+40>)
        at /usr/include/c++/13/bits/unordered_map.h:798
    LibreOffice#35 0x00007ffff6b164a0 in std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7ffff6f64960 <(anonymous namespace)::gaClients>)
        at /usr/include/c++/13/debug/unordered_map:234
    LibreOffice#36 0x00007ffff6b14151 in comphelper::AccessibleEventNotifier::shutdown() () at .../comphelper/source/misc/accessibleeventnotifier.cxx:268
    LibreOffice#37 0x00007fffee53fa20 in DeInitVCL() () at .../vcl/source/app/svmain.cxx:594
    LibreOffice#38 0x00007fffee53e227 in ImplSVMain() () at .../vcl/source/app/svmain.cxx:229
    LibreOffice#39 0x00007fffee53e283 in SVMain() () at .../vcl/source/app/svmain.cxx:236
    LibreOffice#40 0x00007ffff7a9f51d in soffice_main() () at .../desktop/source/app/sofficemain.cxx:94
    LibreOffice#41 0x00005555555549d4 in sal_main () at .../desktop/source/app/main.c:51
    LibreOffice#42 0x00005555555549ba in main (argc=2, argv=0x7fffffffd8e8) at .../desktop/source/app/main.c:49

Change-Id: I22c665f3c41624f4916b956ea266ff1d39fbe507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155848
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
wwjiang007 pushed a commit to wwjiang007/LibreOffice-core that referenced this pull request Oct 2, 2023
The start index of the selection can be larger than the
end index.
Take that into account when using these indices to
calculate the index and character count to copy
the relevant substring using `OUString::copy`.

Without this, running the tdf#157304 macro would trigger
an assert due to invalid indices being used.

Backtrace:

    soffice.bin: .../libreoffice/sal/rtl/strtmpl.hxx:890: void rtl::str::newfromsubstring(rtl_tstring**, const rtl_tstring*, sal_int32, sal_int32) [with rtl_tstring = _rtl_ustring; sal_int32 = int]: assertion `false' failed.

    Thread 1 "soffice.bin" received signal SIGABRT, Aborted.
    __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    LibreOffice#1  0x00007ffff78a814f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    LibreOffice#2  0x00007ffff785a462 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    LibreOffice#3  0x00007ffff78444b2 in __GI_abort () at ./stdlib/abort.c:79
    LibreOffice#4  0x00007ffff78443d5 in __assert_fail_base
        (fmt=0x7ffff79b8dc8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ffff7f6f2ec "false", file=file@entry=0x7ffff7f6be70 ".../libreoffice/sal/rtl/strtmpl.hxx", line=line@entry=890, function=function@entry=0x7ffff7f6f260 "void rtl::str::newFromSubString(rtl_tString**, const rtl_tString*, sal_Int32, sal_Int32) [with rtl_tString = _rtl_uString; sal_Int32 = int]") at ./assert/assert.c:92
    LibreOffice#5  0x00007ffff78533a2 in __assert_fail
        (assertion=0x7ffff7f6f2ec "false", file=0x7ffff7f6be70 ".../libreoffice/sal/rtl/strtmpl.hxx", line=890, function=0x7ffff7f6f260 "void rtl::str::newFromSubString(rtl_tString**, const rtl_tString*, sal_Int32, sal_Int32) [with rtl_tString = _rtl_uString; sal_Int32 = int]") at ./assert/assert.c:101
    LibreOffice#6  0x00007ffff7eee8b7 in rtl::str::newFromSubString<_rtl_uString>(_rtl_uString**, _rtl_uString const*, int, int) (ppThis=0x7fffffffae40, pFrom=0x55555e7af450, beginIndex=6, count=-6)
        at .../libreoffice/sal/rtl/strtmpl.hxx:890
    LibreOffice#7  0x00007ffff7ee91ca in rtl_uString_newFromSubString(rtl_uString**, rtl_uString const*, sal_Int32, sal_Int32) (ppThis=0x7fffffffae40, pFrom=0x55555e7af450, beginIndex=6, count=-6)
        at .../libreoffice/sal/rtl/ustring.cxx:1219
    LibreOffice#8  0x00007ffff1697b52 in rtl::OUString::copy(int, int) const (this=0x7fffffffae88, beginIndex=6, count=-6) at .../libreoffice/include/rtl/ustring.hxx:2229
    LibreOffice#9  0x00007ffff1814180 in svt::EntryImplementation::GetSelected(LineEnd) const (this=0x55555ed5e660) at .../libreoffice/include/svtools/editbrowsebox.hxx:371
    LibreOffice#10 0x00007ffff180d61b in FmXEditCell::getSelectedText() (this=0x55555ed5d500) at .../libreoffice/svx/source/fmcomp/gridcell.cxx:3739
    LibreOffice#11 0x00007fffdc1496f5 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*)
        (pThis=0x55555ed5d600, nVtableIndex=8, pRegisterReturn=0x7fffffffb2f0, pReturnTypeRef=0x555555743db0, bSimpleReturn=false, pStack=0x7fffffffb020, nStack=0, pGPR=0x7fffffffb180, pFPR=0x7fffffffb1b0)
        at .../libreoffice/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:75
    LibreOffice#12 0x00007fffdc1481a0 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void*, void**, uno_Any**)
        (pThis=0x55555e7b0490, aVtableSlot=..., pReturnTypeRef=0x555555743db0, nParams=0, pParams=0x0, pUnoReturn=0x7fffffffb2f0, pUnoArgs=0x7fffffffb2e0, ppUnoExc=0x7fffffffb3d0)
        at .../libreoffice/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233
    LibreOffice#13 0x00007fffdc148cdd in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**)
        (pUnoI=0x55555e7b0490, pMemberDescr=0x55555cccccc0, pReturn=0x7fffffffb2f0, pArgs=0x7fffffffb2e0, ppException=0x7fffffffb3d0) at .../libreoffice/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413
    LibreOffice#14 0x00007fff5beb45f2 in stoc_corefl::(anonymous namespace)::IdlInterfaceMethodImpl::invoke(com::sun::star::uno::Any const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&)
        (this=0x55555ed792f0, rObj=uno::Any("com.sun.star.uno.XInterface": ...), rArgs=empty uno::Sequence) at .../libreoffice/stoc/source/corereflection/criface.cxx:590
    LibreOffice#15 0x00007fff68020606 in (anonymous namespace)::IntrospectionAccessStatic_Impl::getPropertyValueByIndex(com::sun::star::uno::Any const&, sal_Int32) const
        (this=0x55555cc55910, obj=uno::Any("com.sun.star.uno.XInterface": ...), nSequenceIndex=13) at .../libreoffice/stoc/source/inspect/introspection.cxx:588
    LibreOffice#16 0x00007fff68020161 in (anonymous namespace)::IntrospectionAccessStatic_Impl::getPropertyValue(com::sun::star::uno::Any const&, rtl::OUString const&) const
        (this=0x55555cc55910, obj=uno::Any("com.sun.star.uno.XInterface": ...), aPropertyName="SelectedText") at .../libreoffice/stoc/source/inspect/introspection.cxx:498
    LibreOffice#17 0x00007fff68022522 in (anonymous namespace)::ImplIntrospectionAccess::getPropertyValue(rtl::OUString const&) (this=0x55555f4211a0, aPropertyName="SelectedText")
        at .../libreoffice/stoc/source/inspect/introspection.cxx:1014
    LibreOffice#18 0x00007ffff4edb132 in SbUnoObject::Notify(SfxBroadcaster&, SfxHint const&) (this=0x55555e7b0530, rBC=..., rHint=...) at .../libreoffice/basic/source/classes/sbunoobj.cxx:2059
    LibreOffice#19 0x00007ffff39c55f6 in SfxBroadcaster::Broadcast(SfxHint const&) (this=0x55555e7b07d0, rHint=...) at .../libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
    LibreOffice#20 0x00007ffff505a52b in SbxVariable::Broadcast(SfxHintId) (this=0x55555e7b09d0, nHintId=SfxHintId::BasicDataWanted) at .../libreoffice/basic/source/sbx/sbxvar.cxx:155
    LibreOffice#21 0x00007ffff5054564 in SbxValue::Get(SbxValues&) const (this=0x55555e7b09d0, rRes=...) at .../libreoffice/basic/source/sbx/sbxvalue.cxx:289
    LibreOffice#22 0x00007ffff50568fe in SbxValue::Compute(SbxOperator, SbxValue const&) (this=0x55555f441ac0, eOp=SbxCAT, rOp=...) at .../libreoffice/basic/source/sbx/sbxvalue.cxx:809
    LibreOffice#23 0x00007ffff4fd4fb9 in SbiRuntime::StepArith(SbxOperator) (this=0x55555f43f5d0, eOp=SbxCAT) at .../libreoffice/basic/source/runtime/runtime.cxx:1305
    LibreOffice#24 0x00007ffff4fd580d in SbiRuntime::StepCAT() (this=0x55555f43f5d0) at .../libreoffice/basic/source/runtime/runtime.cxx:1418
    LibreOffice#25 0x00007ffff4fd2fb8 in SbiRuntime::Step() (this=0x55555f43f5d0) at .../libreoffice/basic/source/runtime/runtime.cxx:795
    LibreOffice#26 0x00007ffff4f1c85f in (anonymous namespace)::RunInitGuard::run() (this=0x7fffffffbb40) at .../libreoffice/basic/source/classes/sbxmod.cxx:1017
    LibreOffice#27 0x00007ffff4f1d2f5 in SbModule::Run(SbMethod*) (this=0x55555cc779e0, pMeth=0x55555f435130) at .../libreoffice/basic/source/classes/sbxmod.cxx:1177
    LibreOffice#28 0x00007ffff4f1b907 in SbModule::Notify(SfxBroadcaster&, SfxHint const&) (this=0x55555cc779e0, rBC=..., rHint=...) at .../libreoffice/basic/source/classes/sbxmod.cxx:775
    LibreOffice#29 0x00007ffff39c55f6 in SfxBroadcaster::Broadcast(SfxHint const&) (this=0x55555f4305d0, rHint=...) at .../libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
    LibreOffice#30 0x00007ffff4f221e4 in SbMethod::Broadcast(SfxHintId) (this=0x55555f430500, nHintId=SfxHintId::BasicDataWanted) at .../libreoffice/basic/source/classes/sbxmod.cxx:2121
    LibreOffice#31 0x00007ffff5054564 in SbxValue::Get(SbxValues&) const (this=0x55555f430500, rRes=...) at .../libreoffice/basic/source/sbx/sbxvalue.cxx:289
    LibreOffice#32 0x00007ffff4f21e88 in SbMethod::Call(SbxValue*, SbxVariable*) (this=0x55555f430500, pRet=0x55555f42fff0, pCaller=0x55555f441b60) at .../libreoffice/basic/source/classes/sbxmod.cxx:2077
    LibreOffice#33 0x00007fff60031152 in basprov::BasicScriptImpl::invoke(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&)
        (this=0x55555eddeae0, aParams=uno::Sequence of length 1 = {...}, aOutParamIndex=empty uno::Sequence, aOutParam=empty uno::Sequence) at .../libreoffice/scripting/source/basprov/basscript.cxx:252
    LibreOffice#34 0x00007ffff440c3e8 in SfxObjectShell::CallXScript(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Any&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&, bool, com::sun::star::uno::Any const*)
        (_rxScriptContext=uno::Reference to (SwXTextDocument *) 0x55555c8acf20, _rScriptURL="vnd.sun.star.script:Standard.Module1.TestFocus?language=Basic&location=document", aParams=uno::Sequence of length 1 = {...}, aRet=uno::Any(void), aOutParamIndex=empty uno::Sequence, aOutParam=empty uno::Sequence, bRaiseError=true, pCaller=0x7fffffffc670) at .../libreoffice/sfx2/source/doc/objmisc.cxx:1439
    LibreOffice#35 0x00007ffff440c8ea in SfxObjectShell::CallXScript(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Any&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&, bool, com::sun::star::uno::Any const*)
        (this=0x55555794e5c0, rScriptURL="vnd.sun.star.script:Standard.Module1.TestFocus?language=Basic&location=document", aParams=uno::Sequence of length 1 = {...}, aRet=uno::Any(void), aOutParamIndex=empty uno::Sequence, aOutParam=empty uno::Sequence, bRaiseError=true, pCaller=0x7fffffffc670) at .../libreoffice/sfx2/source/doc/objmisc.cxx:1468
    LibreOffice#36 0x00007ffff1904e37 in svxform::(anonymous namespace)::NewStyleUNOScript::invoke(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Any&)
        (this=0x55555e778920, _rArguments=uno::Sequence of length 1 = {...}, _rSynchronousResult=uno::Any(void)) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:831
    LibreOffice#37 0x00007ffff1905461 in svxform::FormScriptingEnvironment::doFireScriptEvent(com::sun::star::script::ScriptEvent const&, com::sun::star::uno::Any*) (this=0x55555c8e5f10, _rEvent=..., _pSynchronousResult=0x0)
        at .../libreoffice/svx/source/form/fmscriptingenv.cxx:905
    LibreOffice#38 0x00007ffff1904264 in svxform::FormScriptListener::impl_doFireScriptEvent_nothrow(std::unique_lock<std::mutex>&, com::sun::star::script::ScriptEvent const&, com::sun::star::uno::Any*)
        (this=0x55555c8e80e0, _rGuard=..., _rEvent=..., _pSynchronousResult=0x0) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:684
    LibreOffice#39 0x00007ffff190469f in svxform::FormScriptListener::OnAsyncScriptEvent(void*) (this=0x55555c8e80e0, p=0x55555e778870) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:744
    LibreOffice#40 0x00007ffff19045eb in svxform::FormScriptListener::LinkStubOnAsyncScriptEvent(void*, void*) (instance=0x55555c8e80e0, data=0x55555e778870) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:733
    LibreOffice#41 0x00007fffeddb80ed in Link<void*, void>::Call(void*) const (this=0x55555e7788c8, data=0x55555e778870) at .../libreoffice/include/tools/link.hxx:111
    LibreOffice#42 0x00007fffeddb51aa in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x55555e7788c0) at .../libreoffice/vcl/source/window/winproc.cxx:2287
    LibreOffice#43 0x00007fffeddb70d7 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x555556c6da40, nEvent=SalEvent::UserEvent, pEvent=0x55555e7788c0)
        at .../libreoffice/vcl/source/window/winproc.cxx:2851
    #44 0x00007fffe2e98caa in SalFrame::CallCallback(SalEvent, void const*) const (this=0x555556c6f760, nEvent=SalEvent::UserEvent, pEvent=0x55555e7788c0) at .../libreoffice/vcl/inc/salframe.hxx:310
    #45 0x00007fffe2eb8973 in QtInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x55555573db20, aEvent=...) at .../libreoffice/vcl/qt5/QtInstance.cxx:484
    #46 0x00007fffee46593b in operator()() const (__closure=0x7fffffffcc20) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119
    #47 0x00007fffee465c0f in SalUserEventList::DispatchUserEvents(bool) (this=0x55555573db58, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120
    #48 0x00007fffe2eb8458 in QtInstance::ImplYield(bool, bool) (this=0x55555573db20, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt5/QtInstance.cxx:410
    #49 0x00007fffe2eb8603 in QtInstance::DoYield(bool, bool) (this=0x55555573db20, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt5/QtInstance.cxx:432
    #50 0x00007fffee5221a8 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:377
    #51 0x00007fffee522f46 in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:461
    #52 0x00007fffee521e9b in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:355
    #53 0x00007ffff7a36296 in desktop::Desktop::Main() (this=0x7fffffffd720) at .../libreoffice/desktop/source/app/app.cxx:1601
    #54 0x00007fffee541f42 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:204
    #55 0x00007fffee542077 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:236
    #56 0x00007ffff7aa1b81 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #57 0x00005555555549d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #58 0x00005555555549ba in main (argc=2, argv=0x7fffffffd948) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: Ib6989cc302419bf44a59bd2fff159257f647726d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157017
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Oct 11, 2023
The start index of the selection can be larger than the
end index.
Take that into account when using these indices to
calculate the index and character count to copy
the relevant substring using `OUString::copy`.

Without this, running the tdf#157304 macro would trigger
an assert due to invalid indices being used.

Backtrace:

    soffice.bin: .../libreoffice/sal/rtl/strtmpl.hxx:890: void rtl::str::newfromsubstring(rtl_tstring**, const rtl_tstring*, sal_int32, sal_int32) [with rtl_tstring = _rtl_ustring; sal_int32 = int]: assertion `false' failed.

    Thread 1 "soffice.bin" received signal SIGABRT, Aborted.
    __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007ffff78a814f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007ffff785a462 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007ffff78444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007ffff78443d5 in __assert_fail_base
        (fmt=0x7ffff79b8dc8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ffff7f6f2ec "false", file=file@entry=0x7ffff7f6be70 ".../libreoffice/sal/rtl/strtmpl.hxx", line=line@entry=890, function=function@entry=0x7ffff7f6f260 "void rtl::str::newFromSubString(rtl_tString**, const rtl_tString*, sal_Int32, sal_Int32) [with rtl_tString = _rtl_uString; sal_Int32 = int]") at ./assert/assert.c:92
    #5  0x00007ffff78533a2 in __assert_fail
        (assertion=0x7ffff7f6f2ec "false", file=0x7ffff7f6be70 ".../libreoffice/sal/rtl/strtmpl.hxx", line=890, function=0x7ffff7f6f260 "void rtl::str::newFromSubString(rtl_tString**, const rtl_tString*, sal_Int32, sal_Int32) [with rtl_tString = _rtl_uString; sal_Int32 = int]") at ./assert/assert.c:101
    #6  0x00007ffff7eee8b7 in rtl::str::newFromSubString<_rtl_uString>(_rtl_uString**, _rtl_uString const*, int, int) (ppThis=0x7fffffffae40, pFrom=0x55555e7af450, beginIndex=6, count=-6)
        at .../libreoffice/sal/rtl/strtmpl.hxx:890
    #7  0x00007ffff7ee91ca in rtl_uString_newFromSubString(rtl_uString**, rtl_uString const*, sal_Int32, sal_Int32) (ppThis=0x7fffffffae40, pFrom=0x55555e7af450, beginIndex=6, count=-6)
        at .../libreoffice/sal/rtl/ustring.cxx:1219
    #8  0x00007ffff1697b52 in rtl::OUString::copy(int, int) const (this=0x7fffffffae88, beginIndex=6, count=-6) at .../libreoffice/include/rtl/ustring.hxx:2229
    #9  0x00007ffff1814180 in svt::EntryImplementation::GetSelected(LineEnd) const (this=0x55555ed5e660) at .../libreoffice/include/svtools/editbrowsebox.hxx:371
    #10 0x00007ffff180d61b in FmXEditCell::getSelectedText() (this=0x55555ed5d500) at .../libreoffice/svx/source/fmcomp/gridcell.cxx:3739
    #11 0x00007fffdc1496f5 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*)
        (pThis=0x55555ed5d600, nVtableIndex=8, pRegisterReturn=0x7fffffffb2f0, pReturnTypeRef=0x555555743db0, bSimpleReturn=false, pStack=0x7fffffffb020, nStack=0, pGPR=0x7fffffffb180, pFPR=0x7fffffffb1b0)
        at .../libreoffice/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:75
    #12 0x00007fffdc1481a0 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void*, void**, uno_Any**)
        (pThis=0x55555e7b0490, aVtableSlot=..., pReturnTypeRef=0x555555743db0, nParams=0, pParams=0x0, pUnoReturn=0x7fffffffb2f0, pUnoArgs=0x7fffffffb2e0, ppUnoExc=0x7fffffffb3d0)
        at .../libreoffice/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233
    #13 0x00007fffdc148cdd in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**)
        (pUnoI=0x55555e7b0490, pMemberDescr=0x55555cccccc0, pReturn=0x7fffffffb2f0, pArgs=0x7fffffffb2e0, ppException=0x7fffffffb3d0) at .../libreoffice/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413
    #14 0x00007fff5beb45f2 in stoc_corefl::(anonymous namespace)::IdlInterfaceMethodImpl::invoke(com::sun::star::uno::Any const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&)
        (this=0x55555ed792f0, rObj=uno::Any("com.sun.star.uno.XInterface": ...), rArgs=empty uno::Sequence) at .../libreoffice/stoc/source/corereflection/criface.cxx:590
    #15 0x00007fff68020606 in (anonymous namespace)::IntrospectionAccessStatic_Impl::getPropertyValueByIndex(com::sun::star::uno::Any const&, sal_Int32) const
        (this=0x55555cc55910, obj=uno::Any("com.sun.star.uno.XInterface": ...), nSequenceIndex=13) at .../libreoffice/stoc/source/inspect/introspection.cxx:588
    #16 0x00007fff68020161 in (anonymous namespace)::IntrospectionAccessStatic_Impl::getPropertyValue(com::sun::star::uno::Any const&, rtl::OUString const&) const
        (this=0x55555cc55910, obj=uno::Any("com.sun.star.uno.XInterface": ...), aPropertyName="SelectedText") at .../libreoffice/stoc/source/inspect/introspection.cxx:498
    #17 0x00007fff68022522 in (anonymous namespace)::ImplIntrospectionAccess::getPropertyValue(rtl::OUString const&) (this=0x55555f4211a0, aPropertyName="SelectedText")
        at .../libreoffice/stoc/source/inspect/introspection.cxx:1014
    #18 0x00007ffff4edb132 in SbUnoObject::Notify(SfxBroadcaster&, SfxHint const&) (this=0x55555e7b0530, rBC=..., rHint=...) at .../libreoffice/basic/source/classes/sbunoobj.cxx:2059
    #19 0x00007ffff39c55f6 in SfxBroadcaster::Broadcast(SfxHint const&) (this=0x55555e7b07d0, rHint=...) at .../libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
    #20 0x00007ffff505a52b in SbxVariable::Broadcast(SfxHintId) (this=0x55555e7b09d0, nHintId=SfxHintId::BasicDataWanted) at .../libreoffice/basic/source/sbx/sbxvar.cxx:155
    #21 0x00007ffff5054564 in SbxValue::Get(SbxValues&) const (this=0x55555e7b09d0, rRes=...) at .../libreoffice/basic/source/sbx/sbxvalue.cxx:289
    #22 0x00007ffff50568fe in SbxValue::Compute(SbxOperator, SbxValue const&) (this=0x55555f441ac0, eOp=SbxCAT, rOp=...) at .../libreoffice/basic/source/sbx/sbxvalue.cxx:809
    #23 0x00007ffff4fd4fb9 in SbiRuntime::StepArith(SbxOperator) (this=0x55555f43f5d0, eOp=SbxCAT) at .../libreoffice/basic/source/runtime/runtime.cxx:1305
    #24 0x00007ffff4fd580d in SbiRuntime::StepCAT() (this=0x55555f43f5d0) at .../libreoffice/basic/source/runtime/runtime.cxx:1418
    #25 0x00007ffff4fd2fb8 in SbiRuntime::Step() (this=0x55555f43f5d0) at .../libreoffice/basic/source/runtime/runtime.cxx:795
    #26 0x00007ffff4f1c85f in (anonymous namespace)::RunInitGuard::run() (this=0x7fffffffbb40) at .../libreoffice/basic/source/classes/sbxmod.cxx:1017
    #27 0x00007ffff4f1d2f5 in SbModule::Run(SbMethod*) (this=0x55555cc779e0, pMeth=0x55555f435130) at .../libreoffice/basic/source/classes/sbxmod.cxx:1177
    #28 0x00007ffff4f1b907 in SbModule::Notify(SfxBroadcaster&, SfxHint const&) (this=0x55555cc779e0, rBC=..., rHint=...) at .../libreoffice/basic/source/classes/sbxmod.cxx:775
    #29 0x00007ffff39c55f6 in SfxBroadcaster::Broadcast(SfxHint const&) (this=0x55555f4305d0, rHint=...) at .../libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
    #30 0x00007ffff4f221e4 in SbMethod::Broadcast(SfxHintId) (this=0x55555f430500, nHintId=SfxHintId::BasicDataWanted) at .../libreoffice/basic/source/classes/sbxmod.cxx:2121
    #31 0x00007ffff5054564 in SbxValue::Get(SbxValues&) const (this=0x55555f430500, rRes=...) at .../libreoffice/basic/source/sbx/sbxvalue.cxx:289
    #32 0x00007ffff4f21e88 in SbMethod::Call(SbxValue*, SbxVariable*) (this=0x55555f430500, pRet=0x55555f42fff0, pCaller=0x55555f441b60) at .../libreoffice/basic/source/classes/sbxmod.cxx:2077
    #33 0x00007fff60031152 in basprov::BasicScriptImpl::invoke(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&)
        (this=0x55555eddeae0, aParams=uno::Sequence of length 1 = {...}, aOutParamIndex=empty uno::Sequence, aOutParam=empty uno::Sequence) at .../libreoffice/scripting/source/basprov/basscript.cxx:252
    #34 0x00007ffff440c3e8 in SfxObjectShell::CallXScript(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Any&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&, bool, com::sun::star::uno::Any const*)
        (_rxScriptContext=uno::Reference to (SwXTextDocument *) 0x55555c8acf20, _rScriptURL="vnd.sun.star.script:Standard.Module1.TestFocus?language=Basic&location=document", aParams=uno::Sequence of length 1 = {...}, aRet=uno::Any(void), aOutParamIndex=empty uno::Sequence, aOutParam=empty uno::Sequence, bRaiseError=true, pCaller=0x7fffffffc670) at .../libreoffice/sfx2/source/doc/objmisc.cxx:1439
    #35 0x00007ffff440c8ea in SfxObjectShell::CallXScript(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Any&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&, bool, com::sun::star::uno::Any const*)
        (this=0x55555794e5c0, rScriptURL="vnd.sun.star.script:Standard.Module1.TestFocus?language=Basic&location=document", aParams=uno::Sequence of length 1 = {...}, aRet=uno::Any(void), aOutParamIndex=empty uno::Sequence, aOutParam=empty uno::Sequence, bRaiseError=true, pCaller=0x7fffffffc670) at .../libreoffice/sfx2/source/doc/objmisc.cxx:1468
    #36 0x00007ffff1904e37 in svxform::(anonymous namespace)::NewStyleUNOScript::invoke(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Any&)
        (this=0x55555e778920, _rArguments=uno::Sequence of length 1 = {...}, _rSynchronousResult=uno::Any(void)) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:831
    #37 0x00007ffff1905461 in svxform::FormScriptingEnvironment::doFireScriptEvent(com::sun::star::script::ScriptEvent const&, com::sun::star::uno::Any*) (this=0x55555c8e5f10, _rEvent=..., _pSynchronousResult=0x0)
        at .../libreoffice/svx/source/form/fmscriptingenv.cxx:905
    #38 0x00007ffff1904264 in svxform::FormScriptListener::impl_doFireScriptEvent_nothrow(std::unique_lock<std::mutex>&, com::sun::star::script::ScriptEvent const&, com::sun::star::uno::Any*)
        (this=0x55555c8e80e0, _rGuard=..., _rEvent=..., _pSynchronousResult=0x0) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:684
    #39 0x00007ffff190469f in svxform::FormScriptListener::OnAsyncScriptEvent(void*) (this=0x55555c8e80e0, p=0x55555e778870) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:744
    #40 0x00007ffff19045eb in svxform::FormScriptListener::LinkStubOnAsyncScriptEvent(void*, void*) (instance=0x55555c8e80e0, data=0x55555e778870) at .../libreoffice/svx/source/form/fmscriptingenv.cxx:733
    #41 0x00007fffeddb80ed in Link<void*, void>::Call(void*) const (this=0x55555e7788c8, data=0x55555e778870) at .../libreoffice/include/tools/link.hxx:111
    #42 0x00007fffeddb51aa in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x55555e7788c0) at .../libreoffice/vcl/source/window/winproc.cxx:2287
    #43 0x00007fffeddb70d7 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x555556c6da40, nEvent=SalEvent::UserEvent, pEvent=0x55555e7788c0)
        at .../libreoffice/vcl/source/window/winproc.cxx:2851
    #44 0x00007fffe2e98caa in SalFrame::CallCallback(SalEvent, void const*) const (this=0x555556c6f760, nEvent=SalEvent::UserEvent, pEvent=0x55555e7788c0) at .../libreoffice/vcl/inc/salframe.hxx:310
    #45 0x00007fffe2eb8973 in QtInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x55555573db20, aEvent=...) at .../libreoffice/vcl/qt5/QtInstance.cxx:484
    #46 0x00007fffee46593b in operator()() const (__closure=0x7fffffffcc20) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119
    #47 0x00007fffee465c0f in SalUserEventList::DispatchUserEvents(bool) (this=0x55555573db58, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120
    #48 0x00007fffe2eb8458 in QtInstance::ImplYield(bool, bool) (this=0x55555573db20, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt5/QtInstance.cxx:410
    #49 0x00007fffe2eb8603 in QtInstance::DoYield(bool, bool) (this=0x55555573db20, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt5/QtInstance.cxx:432
    #50 0x00007fffee5221a8 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:377
    #51 0x00007fffee522f46 in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:461
    #52 0x00007fffee521e9b in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:355
    #53 0x00007ffff7a36296 in desktop::Desktop::Main() (this=0x7fffffffd720) at .../libreoffice/desktop/source/app/app.cxx:1601
    #54 0x00007fffee541f42 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:204
    #55 0x00007fffee542077 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:236
    #56 0x00007ffff7aa1b81 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #57 0x00005555555549d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #58 0x00005555555549ba in main (argc=2, argv=0x7fffffffd948) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: Ib6989cc302419bf44a59bd2fff159257f647726d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157017
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit 2632ce875f9a9c3b0a7861112dbfc48fe17bc2a5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156961
Reviewed-by: Xisco Fauli <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Oct 16, 2023
...as seen during CppunitTest_sd_import_tests2,

> pixman-sse2.c:522:16: runtime error: load of misaligned address 0x5170000a4f83 for type 'const uint32_t *' (aka 'const unsigned int *'), which requires 4 byte alignment
> 0x5170000a4f83: note: pointer points here
>  00  b8 ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff c0 00  b8 ff ff ff ff ff ff
>               ^
>  #0 in combine1 at workdir/UnpackedTarball/pixman/pixman/pixman-sse2.c:522:5
>  #1 in sse2_combine_add_u at workdir/UnpackedTarball/pixman/pixman/pixman-sse2.c:1366:6
>  #2 in sse2_composite_add_8_8 at workdir/UnpackedTarball/pixman/pixman/pixman-sse2.c:4490:2
>  #3 in add_glyphs at workdir/UnpackedTarball/pixman/pixman/pixman-glyph.c:615:6
>  #4 in pixman_composite_glyphs at workdir/UnpackedTarball/pixman/pixman/pixman-glyph.c:673:5
>  #5 in composite_glyphs at workdir/UnpackedTarball/cairo/src/cairo-image-compositor.c:941:2
>  #6 in composite_glyphs at workdir/UnpackedTarball/cairo/src/cairo-traps-compositor.c:2295:12
>  #7 in clip_and_composite at workdir/UnpackedTarball/cairo/src/cairo-traps-compositor.c:1049:15
>  #8 in _cairo_traps_compositor_glyphs at workdir/UnpackedTarball/cairo/src/cairo-traps-compositor.c:2331:11
>  #9 in _cairo_compositor_glyphs at workdir/UnpackedTarball/cairo/src/cairo-compositor.c:292:11
>  #10 in _cairo_image_surface_glyphs at workdir/UnpackedTarball/cairo/src/cairo-image-surface.c:1030:12
>  #11 in _cairo_surface_show_text_glyphs at workdir/UnpackedTarball/cairo/src/cairo-surface.c:2920:15
>  #12 in _cairo_gstate_show_text_glyphs at workdir/UnpackedTarball/cairo/src/cairo-gstate.c:2077:15
>  #13 in _cairo_default_context_glyphs at workdir/UnpackedTarball/cairo/src/cairo-default-context.c:1334:12
>  #14 in cairo_show_glyphs at workdir/UnpackedTarball/cairo/src/cairo.c:3670:14
>  #15 in CairoTextRender::DrawTextLayout(GenericSalLayout const&, SalGraphics const&) at vcl/unx/generic/gdi/cairotextrender.cxx:476:9
>  #16 in SvpSalGraphics::DrawTextLayout(GenericSalLayout const&) at vcl/headless/svptext.cxx:72:23
>  #17 in GenericSalLayout::DrawText(SalGraphics&) const at vcl/source/gdi/CommonSalLayout.cxx:171:18
>  #18 in OutputDevice::ImplDrawTextDirect(SalLayout&, bool) at vcl/source/outdev/text.cxx:331:16
>  #19 in OutputDevice::ImplDrawText(SalLayout&) at vcl/source/outdev/text.cxx:482:9
>  #20 in OutputDevice::DrawTextArray(Point const&, rtl::OUString const&, KernArraySpan, std::span<unsigned char const, 18446744073709551615ul>, int, int, SalLayoutFlags, SalLayoutGlyphs const*) at vcl/source/outdev/text.cxx:951:9
>  #21 in drawinglayer::processor2d::VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(drawinglayer::primitive2d::TextSimplePortionPrimitive2D const&) at drawinglayer/source/processor2d/vclprocessor2d.cxx:422:33
>  #22 in drawinglayer::processor2d::VclPixelProcessor2D::processTextSimplePortionPrimitive2D(drawinglayer::primitive2d::TextSimplePortionPrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:404:9
>  #23 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:200:13
>  #24 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #25 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #26 in drawinglayer::primitive2d::GroupPrimitive2D::getChildren(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&) const at include/drawinglayer/primitive2d/groupprimitive2d.hxx:76:90
>  #27 in drawinglayer::primitive2d::GroupPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/groupprimitive2d.cxx:53:13
>  #28 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #29 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #30 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #31 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #32 in drawinglayer::primitive2d::GroupPrimitive2D::getChildren(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&) const at include/drawinglayer/primitive2d/groupprimitive2d.hxx:76:90
>  #33 in drawinglayer::primitive2d::GroupPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/groupprimitive2d.cxx:53:13
>  #34 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #35 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #36 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #37 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #38 in drawinglayer::primitive2d::GroupPrimitive2D::getChildren(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&) const at include/drawinglayer/primitive2d/groupprimitive2d.hxx:76:90
>  #39 in drawinglayer::primitive2d::GroupPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/groupprimitive2d.cxx:53:13
>  #40 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #41 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #42 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #43 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #44 in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:41:14
>  #45 in drawinglayer::primitive2d::SdrTextPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx:235:47
>  #46 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #47 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #48 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #49 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #50 in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:41:14
>  #51 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #52 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #53 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #54 in sdr::contact::ObjectContactOfPageView::DoProcessDisplay(sdr::contact::DisplayInfo&) at svx/source/sdr/contact/objectcontactofpageview.cxx:279:31
>  #55 in sdr::contact::ObjectContactOfPageView::ProcessDisplay(sdr::contact::DisplayInfo&) at svx/source/sdr/contact/objectcontactofpageview.cxx:117:21
>  #56 in SdrPageWindow::RedrawAll(sdr::contact::ViewObjectContactRedirector*) at svx/source/svdraw/sdrpagewindow.cxx:354:28
>  #57 in SdrPageView::CompleteRedraw(SdrPaintWindow&, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) at svx/source/svdraw/svdpagv.cxx:239:18
>  #58 in SdrPaintView::DoCompleteRedraw(SdrPaintWindow&, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) at svx/source/svdraw/svdpntv.cxx:610:21
>  #59 in SdrPaintView::CompleteRedraw(OutputDevice*, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) at svx/source/svdraw/svdpntv.cxx:523:5
>  #60 in sd::View::CompleteRedraw(OutputDevice*, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) at sd/source/ui/view/sdview.cxx:498:17
>  #61 in sd::DrawView::CompleteRedraw(OutputDevice*, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) at sd/source/ui/view/drawview.cxx:517:17
>  #62 in sd::DrawDocShell::Draw(OutputDevice*, JobSetup const&, unsigned short, bool) at sd/source/ui/docshell/docshel2.cxx:112:12
>  #63 in SfxObjectShell::DoDraw_Impl(OutputDevice*, Point const&, Fraction const&, Fraction const&, JobSetup const&, unsigned short, bool) at sfx2/source/doc/objembed.cxx:204:5
>  #64 in SfxObjectShell::DoDraw(OutputDevice*, Point const&, Size const&, JobSetup const&, unsigned short, bool) at sfx2/source/doc/objembed.cxx:151:9
>  #65 in SfxObjectShell::CreatePreview_Impl(bool, VirtualDevice*, GDIMetaFile*) const at sfx2/source/doc/objcont.cxx:197:40
>  #66 in SfxObjectShell::GetPreviewBitmap() const at sfx2/source/doc/objcont.cxx:109:9
>  #67 in SfxObjectShell::WriteThumbnail(bool, com::sun::star::uno::Reference<com::sun::star::io::XStream> const&) at sfx2/source/doc/objstor.cxx:3738:31
>  #68 in SfxObjectShell::GenerateAndStoreThumbnail(bool, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&) at sfx2/source/doc/objstor.cxx:3696:33
>  #69 in SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) at sfx2/source/doc/objstor.cxx:1469:19
>  #70 in SfxObjectShell::PreDoSaveAs_Impl(rtl::OUString const&, rtl::OUString const&, SfxItemSet const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/objstor.cxx:2992:39
>  #71 in SfxObjectShell::CommonSaveAs_Impl(INetURLObject const&, rtl::OUString const&, SfxItemSet&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/objstor.cxx:2782:9
>  #72 in SfxObjectShell::APISaveAs_Impl(std::basic_string_view<char16_t, std::char_traits<char16_t>>, SfxItemSet&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/objserv.cxx:319:19
>  #73 in SfxBaseModel::impl_store(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, bool) at sfx2/source/doc/sfxbasemodel.cxx:3191:42
>  #74 in SfxBaseModel::storeToURL(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1801:13
>  #75 in UnoApiTest::saveWithParams(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at test/source/unoapi_test.cxx:213:16
>  #76 in UnoApiTest::save(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:178:5
>  #77 in UnoApiTest::saveAndReload(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:218:5
>  #78 in testOverflowBehaviorClip::TestBody() at sd/qa/unit/import-tests2.cxx:1899:5

Change-Id: Iea3e107608137c4dec9103ee0b04e801284b5fa9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158018
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Nov 28, 2023
After commit 86c6822 (tdf#96401:
allow to detect a broken ZIP package, 2023-11-26) impl_openStream
is called from TypeDetection::impl_detectTypeFlatAndDeep for URIs
like ".component:Bibliography/View1". For some reasons, sometimes
GIO UCP tries to handle these URIs; failing that, it shows an
error message.

This started to fail UITest_writer_tests4 (specifically, test for
tdf92611), like this:

  Thread 1 (Thread 0x7f51cd99b1c0 (LWP 1424555) "soffice.bin"):
  #10 std::condition_variable::wait_for<long int, std::ratio<1, 1000>, SvpSalInstance::ImplYield(bool, bool)::<lambda()> > (__rtime=<optimized out>, __p=..., __lock=..., this=0x13d78e0) at ~/gcc/inst/include/c++/14.0.0/condition_variable:177
  #11 SvpSalInstance::ImplYield(bool, bool) (this=this@entry=0x13d7690, bWait=bWait@entry=true, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/headless/svpinst.cxx:451
  #12 0x00007f51d9d85695 in SvpSalInstance::DoYield(bool, bool) (this=0x13d7690, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at vcl/headless/svpinst.cxx:471
  #13 0x00007f51d9add654 in ImplYield(bool, bool) (i_bWait=i_bWait@entry=true, i_bAllEvents=i_bAllEvents@entry=false) at vcl/source/app/svapp.cxx:390
  #14 0x00007f51d9addc73 in Application::Yield() () at vcl/source/app/svapp.cxx:474
  #15 0x00007f51d946de4f in Dialog::Execute() (this=0x14554e40) at vcl/source/window/dialog.cxx:1078
  #16 0x00007f51d9a5ccec in virtual thunk to SalInstanceDialog::run() () at vcl/inc/salvtables.hxx:543
  #17 0x00007f51d92b45b2 in (anonymous namespace)::executeErrorDialog (nButtonMask=(anonymous namespace)::MessageBoxStyle::Ok, rMessage=Python Exception <class 'gdb.error'>: value has been optimized out
  , rContext=Python Exception <class 'gdb.error'>: value has been optimized out
  , eClassification=com::sun::star::task::InteractionClassification::InteractionClassification_ERROR, pParent=<optimized out>) at uui/source/iahndl-errorhandler.cxx:123
  #18 UUIInteractionHelper::handleErrorHandlerRequest(com::sun::star::task::InteractionClassification, ErrCode, std::__debug::vector<rtl::OUString, std::allocator<rtl::OUString> > const&, com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::task::XInteractionContinuation> > const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, eClassification=com::sun::star::task::InteractionClassification::InteractionClassification_ERROR, nErrorCode=..., nErrorCode@entry=..., rArguments=std::__debug::vector of length 0, capacity 0, rContinuations=uno::Sequence of length 1 = {...}, bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at uui/source/iahndl-errorhandler.cxx:250
  #19 0x00007f51d92bbcd5 in UUIInteractionHelper::handleInteractiveIOException(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8, bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at uui/source/iahndl-ioexceptions.cxx:265
  #20 0x00007f51d92a9e33 in UUIInteractionHelper::handleRequest_impl(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8, bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at uui/source/iahndl.cxx:474
  #21 0x00007f51d92aca90 in UUIInteractionHelper::handleRequest(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) (this=this@entry=0x1408c9a8, rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8) at uui/source/iahndl.cxx:177
  #22 0x00007f51d92c2d36 in (anonymous namespace)::UUIInteractionHandler::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) (this=0x1408c960, rRequest=<optimized out>) at uui/source/interactionhandler.cxx:194
  #23 0x00007f51d8ff8607 in ucbhelper::cancelCommandExecution(com::sun::star::uno::Any const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) (rException=uno::Any("com.sun.star.ucb.InteractiveAugmentedIOException": ...), xEnv=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8) at ucbhelper/source/provider/cancelcommandexecution.cxx:52
  #24 0x00007f5197fd8ddd in gio::Content::getFileInfo(com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, _GFileInfo**, bool) (this=0x13658da0, env=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8, info=<optimized out>, fail=<optimized out>) at ucb/source/ucp/gio/gio_content.cxx:652
  #25 0x00007f5197fdf515 in gio::Content::getPropertyValues(com::sun::star::uno::Sequence<com::sun::star::beans::Property> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) (this=this@entry=0x13658da0, rProperties=uno::Sequence of length 1 = {...}, xEnv=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8) at ucb/source/ucp/gio/gio_content.cxx:448
  #26 0x00007f5197fe031e in gio::Content::execute(com::sun::star::ucb::Command const&, int, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) (this=0x13658da0, aCommand=<optimized out>, xEnv=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8) at ucb/source/ucp/gio/gio_content.cxx:951
  #27 0x00007f51d8fe73ad in ucbhelper::Content_Impl::executeCommand(com::sun::star::ucb::Command const&) (this=0x142235a0, rCommand=...) at ucbhelper/source/client/content.cxx:1264
  #28 0x00007f51d8fe8607 in ucbhelper::Content::getPropertyValuesInterface(com::sun::star::uno::Sequence<rtl::OUString> const&) (this=this@entry=0x7ffd3685a6d0, rPropertyNames=uno::Sequence of length 1 = {...}) at ucbhelper/source/client/content.cxx:500
  #29 0x00007f51d8fe88ba in ucbhelper::Content::getPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&) (this=this@entry=0x7ffd3685a6d0, rPropertyNames=uno::Sequence of length 1 = {...}) at ucbhelper/source/client/content.cxx:458
  #30 0x00007f51d8fe8b37 in ucbhelper::Content::getPropertyValue(rtl::OUString const&) (this=this@entry=0x7ffd3685a6d0, rPropertyName="IsDocument") at ucbhelper/source/client/content.cxx:437
  #31 0x00007f51d8fe9282 in ucbhelper::Content::isDocument() (this=this@entry=0x7ffd3685a6d0) at ucbhelper/source/client/content.cxx:1028
  #32 0x00007f51d8feac5d in ucbhelper::Content::openStream() (this=this@entry=0x7ffd3685a6d0) at ucbhelper/source/client/content.cxx:693
  #33 0x00007f51d9274d77 in utl::MediaDescriptor::impl_openStreamWithURL(rtl::OUString const&, bool) (this=this@entry=0x7ffd3685b400, sURL=".component:Bibliography/View1", bLockFile=bLockFile@entry=true) at unotools/source/misc/mediadescriptor.cxx:468
  #34 0x00007f51d9275951 in utl::MediaDescriptor::impl_addInputStream(bool) (this=0x7ffd3685b400, bLockFile=bLockFile@entry=true) at unotools/source/misc/mediadescriptor.cxx:259
  #35 0x00007f51d927685a in utl::MediaDescriptor::addInputStream() (this=<optimized out>) at unotools/source/misc/mediadescriptor.cxx:220
  #36 0x00007f51d69a7745 in filter::config::TypeDetection::impl_openStream(utl::MediaDescriptor&) (this=this@entry=0x143f7da0, rDescriptor=...) at filter/source/config/cache/typedetection.cxx:1202
  #37 0x00007f51d69a9238 in filter::config::TypeDetection::impl_detectTypeFlatAndDeep(utl::MediaDescriptor&, std::__debug::vector<filter::config::FlatDetectionInfo, std::allocator<filter::config::FlatDetectionInfo> > const&, bool, rtl::OUString&) (this=this@entry=0x143f7da0, rDescriptor=..., lFlatTypes=std::__debug::vector of length 180, capacity 256 = {...}, bAllowDeep=bAllowDeep@entry=true, rLastChance="") at filter/source/config/cache/typedetection.cxx:902
  #38 0x00007f51d69b971f in filter::config::TypeDetection::queryTypeByDescriptor(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&, unsigned char) (this=0x143f7da0, lDescriptor=uno::Sequence of length 6 = {...}, bAllowDeep=1 '\001') at filter/source/config/cache/typedetection.cxx:434
  #39 0x00007f51d6ec41ee in framework::LoadEnv::impl_detectTypeAndFilter() (this=this@entry=0x14501c08) at framework/source/loadenv/loadenv.cxx:774
  #40 0x00007f51d6ec5446 in framework::LoadEnv::start() (this=this@entry=0x14501c08) at framework/source/loadenv/loadenv.cxx:395
  #41 0x00007f51d6ec5b67 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) (this=this@entry=0x14501c08, sURL=".component:Bibliography/View1", lMediaDescriptor=uno::Sequence of length 5 = {...}, xBaseFrame=uno::Reference to (framework::Desktop *) 0x16a8908, sTarget="_blank", nSearchFlags=0, eFeature=(LoadEnvFeatures::WorkWithUI | LoadEnvFeatures::AllowContentHandler)) at framework/source/loadenv/loadenv.cxx:308
  #42 0x00007f51d6d88634 in framework::LoadDispatcher::impl_dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) (this=0x14501bb0, rURL=..., lArguments=uno::Sequence of length 5 = {...}, xListener=empty uno::Reference) at framework/source/dispatch/loaddispatcher.cxx:107
  #43 0x00007f51d6d8987b in non-virtual thunk to framework::LoadDispatcher::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) () at framework/source/inc/dispatch/loaddispatcher.hxx:99
  #44 0x00007f51d761f4d3 in SfxApplication::OpenDocExec_Impl(SfxRequest&) (this=<optimized out>, rReq=<optimized out>) at sfx2/source/appl/appopen.cxx:1097
  #45 0x00007f51d77065c2 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=this@entry=0x2cf43b0, rShell=..., rSlot=..., rReq=..., bRecord=false) at sfx2/source/control/dispatch.cxx:254
  #46 0x00007f51d7711618 in SfxDispatcher::PostMsgHandler(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >) (this=0x2cf43b0, pReq=std::unique_ptr<SfxRequest> = {...}) at ~/gcc/inst/include/c++/14.0.0/bits/unique_ptr.h:193
  #47 0x00007f51d7713d74 in std::__invoke_impl<void, void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(std::__invoke_memfun_deref, void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__f=<optimized out>, __t=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/unique_ptr.h:191
  #48 std::__invoke<void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__fn=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/invoke.h:96
  #49 std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>::__call<void, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&, 0ul, 1ul>(std::tuple<std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&>&&, std::_Index_tuple<0ul, 1ul>) (__args=<optimized out>, this=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/functional:511
  #50 std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>::operator()<std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >, void>(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (this=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/functional:596
  #51 std::__invoke_impl<void, std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(std::__invoke_other, std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__f=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/invoke.h:61
  #52 std::__invoke_r<void, std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__fn=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/invoke.h:111
  #53 std::_Function_handler<void (std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)> >::_M_invoke(std::_Any_data const&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__functor=<optimized out>, __args#0=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/std_function.h:290
  #54 0x00007f51d7a6aa83 in std::function<void (std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>::operator()(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >) const (__args#0=std::unique_ptr<SfxRequest> = {...}, this=0x134550c0) at ~/gcc/inst/include/c++/14.0.0/bits/std_function.h:591
  #55 SfxHintPoster::DoEvent_Impl(void*) (this=0x134550b0, pPostedHint=0x7f5174a248b0) at sfx2/source/notify/hintpost.cxx:43
  #56 0x00007f51d9590f30 in Link<void*, void>::Call(void*) const (data=<optimized out>, this=0x7f51748c59b8) at include/tools/link.hxx:111
  #57 ImplHandleUserEvent (pSVEvent=0x7f51748c59b0) at vcl/source/window/winproc.cxx:2287
  #58 ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x284cc10, nEvent=SalEvent::UserEvent, pEvent=0x7f51748c59b0) at vcl/source/window/winproc.cxx:2851
  #59 0x00007f51d9d8488f in SalFrame::CallCallback(SalEvent, void const*) const (pEvent=0x7f51748c59b0, nEvent=SalEvent::UserEvent, this=0x284f1c0) at include/rtl/ref.hxx:206
  #60 SvpSalInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x13d7690, aEvent=...) at vcl/headless/svpinst.cxx:266
  #61 0x00007f51d9a4b216 in operator() (__closure=<synthetic pointer>) at vcl/source/app/salusereventlist.cxx:119
  #62 SalUserEventList::DispatchUserEvents(bool) (this=this@entry=0x13d76b8, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/source/app/salusereventlist.cxx:120
  #63 0x00007f51d9d84fc3 in SvpSalInstance::ImplYield(bool, bool) (this=this@entry=0x13d7690, bWait=bWait@entry=true, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/headless/svpinst.cxx:395
  #64 0x00007f51d9d85695 in SvpSalInstance::DoYield(bool, bool) (this=0x13d7690, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at vcl/headless/svpinst.cxx:471
  #65 0x00007f51d9add654 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at vcl/source/app/svapp.cxx:390
  #66 0x00007f51d9addd8d in Application::Execute() () at vcl/source/app/svapp.cxx:368
  #67 0x00007f51d7bce212 in desktop::Desktop::Main() (this=0x7ffd3685d0c0) at desktop/source/app/app.cxx:1601
  #68 0x00007f51d9af112b in ImplSVMain() () at vcl/source/app/svmain.cxx:229
  #69 0x00007f51d9af13b5 in SVMain() () at vcl/source/app/svmain.cxx:261
  #70 0x00007f51d7c03c37 in soffice_main() () at desktop/source/app/sofficemain.cxx:94
  #71 0x000000000040078b in sal_main () at desktop/source/app/main.c:51
  #72 main (argc=argc@entry=7, argv=argv@entry=0x7ffd3685d2c8) at desktop/source/app/main.c:49

Strangely, this is inconsistent on Linux systems (shows on some
systems, but not on others).

Prevent this exiting from MediaDescriptor::impl_openStreamWithURL
early for these URIs.

Thank Stephan Bergmann for the help understanding it and deciding
how to fix it.

Change-Id: I84c551916e6643eeb219f23ff778d4418eea9124
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160057
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Jan 19, 2024
...in code newly introduced in 135ce25
"tdf#146487 Don't show generic diagram title when there is an empty title
given", which caused CppunitTest_chart2_export2 to fail with

> /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62: runtime error: load of value 222, which is not a valid value for type 'bool'
>     #0 0x7f95cd9ed87c in oox::drawingml::chart::PlotAreaConverter::isSingleSeriesTitle() const /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62
>     #1 0x7f95cd9e506f in oox::drawingml::chart::ChartSpaceConverter::convertFromModel(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&) /oox/source/drawingml/chart/chartspaceconverter.cxx:189:53
>     #2 0x7f95cd9b6c34 in oox::drawingml::chart::ChartConverter::convertFromModel(oox::core::XmlFilterBase&, oox::drawingml::chart::ChartSpaceModel&, com::sun::star::uno::Reference<com::sun::star::chart2::XChartDocument> const&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&, com::sun::star::awt::Size const&) /oox/source/drawingml/chart/chartconverter.cxx:93:20
>     #3 0x7f95ce548f59 in oox::drawingml::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /oox/source/drawingml/shape.cxx:2245:50
>     #4 0x7f95438150b2 in oox::xls::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /sc/source/filter/oox/drawingfragment.cxx:113:30
>     #5 0x7f95ce5267bb in oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase&, rtl::OUString const&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, bool, bool, basegfx::B2DHomMatrix&, oox::drawingml::FillProperties const&, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:1964:9
>     #6 0x7f95ce4edb54 in oox::drawingml::Shape::addShape(oox::core::XmlFilterBase&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, basegfx::B2DHomMatrix const&, oox::drawingml::FillProperties const&, std::__debug::map<rtl::OUString, std::shared_ptr<oox::drawingml::Shape>, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, std::shared_ptr<oox::drawingml::Shape> > > >*, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:366:41
>     #7 0x7f954381ef79 in oox::xls::DrawingFragment::onEndElement() /sc/source/filter/oox/drawingfragment.cxx:335:30
>     #8 0x7f95cdcaee54 in oox::core::ContextHandler2Helper::implEndElement(int) /oox/source/core/contexthandler2.cxx:125:9
>     #9 0x7f95cdd5c116 in oox::core::FragmentHandler2::endFastElement(int) /oox/source/core/fragmenthandler2.cxx:91:5
>     #10 0x7f95caf68fca in (anonymous namespace)::Entity::endElement() /sax/source/fastparser/fastparser.cxx:514:27
>     #11 0x7f95caf68998 in sax_fastparser::FastSaxParserImpl::callbackEndElement() /sax/source/fastparser/fastparser.cxx:1331:17
>     #12 0x7f95caf58444 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:338:18
>     #13 0x7f960adebeda in xmlParseEndTag2 /workdir/UnpackedTarball/libxml2/parser.c:10090:2
>     #14 0x7f960ad929b5 in xmlParseTryOrFinish /workdir/UnpackedTarball/libxml2/parser.c:11868:14
>     #15 0x7f960ad86334 in xmlParseChunk /workdir/UnpackedTarball/libxml2/parser.c:12151:5
>     #16 0x7f95caf53231 in sax_fastparser::FastSaxParserImpl::parse() /sax/source/fastparser/fastparser.cxx:1085:21
>     #17 0x7f95caf4cd18 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:890:9
>     #18 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #19 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #20 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #21 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #22 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #23 0x7f95441ceaa8 in oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&) /sc/source/filter/oox/workbookhelper.cxx:1046:27
>     #24 0x7f95442797f1 in oox::xls::WorksheetGlobals::finalizeDrawings() /sc/source/filter/oox/worksheethelper.cxx:1373:9
>     #25 0x7f95442789e0 in oox::xls::WorksheetGlobals::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:996:5
>     #26 0x7f954428744d in oox::xls::WorksheetHelper::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:1637:17
>     #27 0x7f95441771de in oox::xls::WorkbookFragment::finalizeImport() /sc/source/filter/oox/workbookfragment.cxx:511:18
>     #28 0x7f95cdd5b3ae in oox::core::FragmentHandler2::endDocument() /oox/source/core/fragmenthandler2.cxx:53:5
>     #29 0x7f95caf4cfc2 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:896:36
>     #30 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #31 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #32 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #33 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #34 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #35 0x7f95435c4daa in oox::xls::ExcelFilter::importDocument() /sc/source/filter/oox/excelfilter.cxx:113:25
>     #36 0x7f95cdcf953b in oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/core/filterbase.cxx:488:49
>     #37 0x7f95435c7733 in oox::xls::ExcelFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sc/source/filter/oox/excelfilter.cxx:176:25
>     #38 0x7f95857c5b40 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sfx2/source/doc/objstor.cxx:2393:34
>     #39 0x7f9585781c6a in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:761:23
>     #40 0x7f95859a9652 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1980:36
>     #41 0x7f95862145e9 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) /sfx2/source/view/frmload.cxx:720:28
>     #42 0x7f95536a9900 in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1176:37
>     #43 0x7f95536a091b in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:412:20
>     #44 0x7f9553698f59 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) /framework/source/loadenv/loadenv.cxx:308:5
>     #45 0x7f95536946e7 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/loadenv/loadenv.cxx:168:14
>     #46 0x7f955376867d in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx:591:16
>     #47 0x7f95537688a6 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx
>     #48 0x7f9569f7cafa in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:71:62
>     #49 0x7f9580718c56 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /test/source/unoapi_test.cxx:126:19
>     #50 0x7f9580717ef8 in UnoApiTest::load(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:108:5
>     #51 0x7f9580719254 in UnoApiTest::loadFromFile(std::basic_string_view<char16_t, std::char_traits<char16_t> >, char const*) /test/source/unoapi_test.cxx:132:5
>     #52 0x7f95d8bf1018 in testTdf123647::TestBody() /chart2/qa/extras/chart2export2.cxx:1242:5

(<https://ci.libreoffice.org//job/lo_ubsan/3048/>)

Change-Id: I870d811e78b8c55b84627ae609f98f623465dd9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162294
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Jan 31, 2024
…n assert

so disable the SolarMutex checks during dumpState and restore afterwards

	#8  0x00007fa179e287f3 in abort () at /lib/x86_64-linux-gnu/libc.so.6
	#9  0x00007fa179e2871b in  () at /lib/x86_64-linux-gnu/libc.so.6
	#10 0x00007fa179e39e96 in  () at /lib/x86_64-linux-gnu/libc.so.6
	#11 0x00007fa1706904de in ImplDbgTestSolarMutex() () at libreoffice/vcl/source/app/dbggui.cxx:35
		__PRETTY_FUNCTION__ = "void ImplDbgTestSolarMutex()"
	#12 0x00007fa1782cb713 in DbgTestSolarMutex() () at libreoffice/tools/source/debug/debug.cxx:54
	#13 0x00007fa170559ebb in VirtualDevice::AcquireGraphics() const (this=0x5589006636b0) at libreoffice/vcl/source/gdi/virdev.cxx:49
		pSVData = 0x7fff8a2386d0
	#14 0x00007fa17020d849 in OutputDevice::DrawRect(tools::Rectangle const&) (this=0x5589006636b0, rRect=...) at libreoffice/vcl/source/outdev/rect.cxx:67
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawRect(const tools::Rectangle&)"
		aRect = {static RECT_EMPTY = -32767, mnLeft = 0, mnTop = 0, mnRight = 10244, mnBottom = 269}
	#15 0x00007fa17021d997 in OutputDevice::DrawColorWallpaper(long, long, long, long, Wallpaper const&) (this=0x5589006636b0, nX=0, nY=0, nWidth=10245, nHeight=270, rWallpaper=...) at libreoffice/vcl/source/outdev/wallpaper.cxx:90
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawColorWallpaper(tools::Long, tools::Long, tools::Long, tools::Long, const Wallpaper&)"
		aOldLineColor = {{mValue = 0, {B = 0 '\000', G = 0 '\000', R = 0 '\000', T = 0 '\000'}}}
		aOldFillColor = {{mValue = 16777215, {B = 255 '\377', G = 255 '\377', R = 255 '\377', T = 0 '\000'}}}
		bMap = false
	#16 0x00007fa17021d851 in OutputDevice::DrawWallpaper(long, long, long, long, Wallpaper const&) (this=0x5589006636b0, nX=0, nY=0, nWidth=10245, nHeight=270, rWallpaper=...) at libreoffice/vcl/source/outdev/wallpaper.cxx:73
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawWallpaper(tools::Long, tools::Long, tools::Long, tools::Long, const Wallpaper&)"
	#17 0x00007fa17021daa8 in OutputDevice::Erase() (this=0x5589006636b0) at libreoffice/vcl/source/outdev/wallpaper.cxx:106
		eRasterOp = RasterOp::OverPaint
	#18 0x00007fa17055c716 in VirtualDevice::InnerImplSetOutputSizePixel(Size const&, bool, unsigned char*) (this=0x5589006636b0, rNewSize=..., bErase=true, pBuffer=0x0) at libreoffice/vcl/source/gdi/virdev.cxx:292
		bRet = true
		nNewWidth = 10245
		nNewHeight = 270
		__PRETTY_FUNCTION__ = "bool VirtualDevice::InnerImplSetOutputSizePixel(const Size&, bool, sal_uInt8*)"
	#19 0x00007fa17055cbf5 in VirtualDevice::ImplSetOutputSizePixel(Size const&, bool, unsigned char*) (this=0x5589006636b0, rNewSize=..., bErase=true, pBuffer=0x0) at libreoffice/vcl/source/gdi/virdev.cxx:360
	#20 0x00007fa17055ceba in VirtualDevice::SetOutputSizePixel(Size const&, bool) (this=0x5589006636b0, rNewSize=..., bErase=true) at libreoffice/vcl/source/gdi/virdev.cxx:408
	#21 0x00007fa16fea3ca4 in VirtualDevice::SetOutputSize(Size const&) (this=0x5589006636b0, rNewSize=...) at libreoffice/include/vcl/virdev.hxx:163
	#22 0x00007fa16fe96388 in VclDrawingArea::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fe9ba320, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:3092
		pDevice = {<ScopedVclPtr<VirtualDevice>> = {<VclPtr<VirtualDevice>> = {m_rInnerRef = {m_pBody = 0x5589006636b0}}, <No data fields>}, <No data fields>}
		pRefDevice = 0x5588ff474fd0
		aRenderSize = {<Pair> = {mnA = 10245, mnB = 270}, <No data fields>}
		aOutputSize = {<Pair> = {mnA = 683, mnB = 18}, <No data fields>}
		aRect = {static RECT_EMPTY = -32767, mnLeft = 140735510973440, mnTop = 140331342376707, mnRight = 140735510973456, mnBottom = 94046886702440}
		aImage = {maBitmap = {_vptr.Bitmap = 0x7fff8a238c20, mxSalBmp = std::shared_ptr<class SalBitmap> (empty) = {get() = 0x7fa16fd029cc <std::__uniq_ptr_impl<WindowImpl, std::default_delete<WindowImpl> >::_M_ptr() const+28>}, maPrefMapMode = {mpImplMapMode = {m_pimpl = 0x7fff8a238d60}}, maPrefSize = {<Pair> = {mnA = 94046793857224, mnB = 140331516265348}, <No data fields>}}, maAlphaMask = {_vptr.Bitmap = 0x0, mxSalBmp = std::shared_ptr<class SalBitmap> (use count 1875914999, weak count 32672) = {get() = 0x5588ff46fa98}, maPrefMapMode = {mpImplMapMode = {m_pimpl = 0x7fa16fd030f7 <std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> >::_M_head(std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> > const&)+28>}}, maPrefSize = {<Pair> = {mnA = 94046793857224, mnB = 94046886754968}, <No data fields>}}, maBitmapSize = {<Pair> = {mnA = 140735510973568, mnB = 140331342377207}, <No data fields>}}
		aOStm = {<SvStream> = {_vptr.SvStream = 0x2ab, m_xLockBytes = {pObj = 0x12}, m_nActPos = 140735510973600, m_pRWBuf = std::unique_ptr<unsigned char []> = {get() = 0x7fa16fd03026 <std::__get_helper<0ul, WindowImpl*, std::default_delete<WindowImpl> >(std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> > const&)+28> "\311\303\363\017\036\372UH\211\345H\203\354\020H\211}\370H\213E\370H\211\307", <incomplete sequence \350\265>}, m_pBufPos = 0x7fff8a238cb0 "\340\214#\212\024", m_nBufSize = 64152, m_nBufActualLen = 65350, m_nBufActualPos = 21896, m_nBufFree = 0, m_isIoRead = 192, m_isIoWrite = 140, m_isDirty = 35, m_isSwap = 138, m_isEof = 255, m_nError = {m_value = 1875914499}, m_nCompressMode = (SvStreamCompressFlags::ZBITMAP | unknown: 0x7fa0), m_eLineDelimiter = (unknown: 0x8a238ce0), m_eStreamCharSet = 20, m_aCryptMaskKey = {pData = 0x5588ff46fa98}, m_nCryptMask = 224 '\340', m_nVersion = 16, m_nBufFilePos = 140735510975776, m_eStreamMode = 2317587744, m_isWritable = 255}, nSize = 140735510973776, nResize = 28087389472, nPos = 140735510975776, nEndOfData = 140735510975776, pBuf = 0x7fff8a238d58 " \225#\212\377\177", bOwnsData = 32}
	#23 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fa90, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -12124904
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fe9ba320
		pAccLabelFor = 0x7fff8a238de0
		pAccLabelledBy = 0x68a238db0
	#24 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fa90, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#25 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fd10, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -12221224
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff46fa90
		pAccLabelFor = 0x7fff8a238e58
		pAccLabelledBy = 0x7fff8a238e20
	#26 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff462d60, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = -1
		nTop = -1
		nWidth = 1
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff46fd10
		pAccLabelFor = 0x5588ff458838
		pAccLabelledBy = 0x7fff8a238e90
	#27 0x00007fa16fe8fecd in VclScrolledWindow::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff462d60, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:2184
	#28 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff458830, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -12220472
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff462d60
		pAccLabelFor = 0x7fff8a238fb0
		pAccLabelledBy = 0x68a238f80
	#29 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff458830, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#30 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff4587c0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -18974136
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff458830
		pAccLabelFor = 0x7fff8a239040
		pAccLabelledBy = 0x68a239010
	#31 0x00007fa16fe8becd in VclGrid::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff4587c0, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:1406
	#32 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fede7a40, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -22893640
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff4587c0
		pAccLabelFor = 0x7fff8a2390d0
		pAccLabelledBy = 0x68a2390a0
	#33 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fede7a40, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#34 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fea2abb0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977380544
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fede7a40
		pAccLabelFor = 0x7fff8a239148
		pAccLabelledBy = 0x7fff8a239110
	#35 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588feddd8a0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 0
		nTop = 2049803913
		nWidth = 32673
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fea2abb0
		pAccLabelFor = 0x7fa16fcdc774 <__gnu_debug::_Safe_sequence_base::~_Safe_sequence_base()+28>
		pAccLabelledBy = 0x0
	#36 0x00007fa16ff6e15e in ToolBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588feddd8a0, rJsonWriter=...) at libreoffice/vcl/source/window/toolbox2.cxx:1713
		childrenNode = {mrWriter = @0x7fa16fd6409c}
	#37 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fee04430, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = -1
		nTop = -1
		nWidth = 1
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588feddd8a0
		pAccLabelFor = 0x7fff8a2393c8
		pAccLabelledBy = 0x7fff8a239390
	#38 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff2738a0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977379792
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fee04430
		pAccLabelFor = 0x7fff8a239438
		pAccLabelledBy = 0x7fff8a239400
	#39 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fedbafd0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977379680
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff2738a0
		pAccLabelFor = 0x7fff8a2394a8
		pAccLabelledBy = 0x7fff8a239470
	#40 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fedc2d50, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 21896
		nTop = 2045399353
		nWidth = 32673
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fedbafd0
		pAccLabelFor = 0x7fff8a239520
		pAccLabelledBy = 0x7fff8a2394e0
	#41 0x00007fa170764efa in vcl::lok::dumpState(rtl::OStringBuffer&) (rState=...) at libreoffice/vcl/source/app/svapp.cxx:1868
		props = {mpBuffer = 0x5588ff911780 "{ \"id\": \"\", \"type\": \"borderwindow\", \"text\": \"hello-world.ods - Collabora OfficeDev Calc 23.05 [ebacfb1]\", \"enabled\": true, \"children\": [ { \"id\": \"\", \"type\": \"workwindo"..., mPos = 0x5588ff912c3c "", mSpaceAllocated = 8244, mStartNodeCount = 24, mbFirstFieldInNode = false, static JSON_WRITER_DEBUG_MARKER = 222 '\336'}
		pSVData = 0x7fa171f3aea0 <rtl::Static<ImplSVData, (anonymous namespace)::private_aImplSVData>::get()::instance>
		pWin = 0x5588fedc2d50
	#42 0x00007fa179b08219 in desktop::LibLibreOffice_Impl::dumpState(rtl::OStringBuffer&) (this=0x5588fa5a7710, rState=...) at libreoffice/desktop/source/lib/init.cxx:5105
	#43 0x00007fa179b08002 in lo_dumpState(LibreOfficeKit*, char const*, char**) (pThis=0x5588fa5a7710, pState=0x7fff8a239630) at libreoffice/desktop/source/lib/init.cxx:5086
		aState = {pData = 0x5588ffa27670, nCapacity = 1048576}
		pLib = 0x5588fa5a7710
		aStr = {pData = 0x5588ff9bfd30}
	#44 0x00005588f9b2e947 in lok::Office::dumpState(char const*, char**) (pState=0x7fff8a239630, pOption=0x5588f9bd5e4d "", this=<optimized out>) at libreoffice/include/LibreOfficeKit/LibreOfficeKit.hxx:1149
		pState = 0x0

Change-Id: Icc5910238656566479ea0796c25779866ff8ec7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162794
Tested-by: Jenkins CollaboraOffice <[email protected]>
Reviewed-by: Michael Meeks <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Jan 31, 2024
…n assert

so disable the SolarMutex checks during dumpState and restore afterwards

	#8  0x00007fa179e287f3 in abort () at /lib/x86_64-linux-gnu/libc.so.6
	#9  0x00007fa179e2871b in  () at /lib/x86_64-linux-gnu/libc.so.6
	#10 0x00007fa179e39e96 in  () at /lib/x86_64-linux-gnu/libc.so.6
	#11 0x00007fa1706904de in ImplDbgTestSolarMutex() () at libreoffice/vcl/source/app/dbggui.cxx:35
		__PRETTY_FUNCTION__ = "void ImplDbgTestSolarMutex()"
	#12 0x00007fa1782cb713 in DbgTestSolarMutex() () at libreoffice/tools/source/debug/debug.cxx:54
	#13 0x00007fa170559ebb in VirtualDevice::AcquireGraphics() const (this=0x5589006636b0) at libreoffice/vcl/source/gdi/virdev.cxx:49
		pSVData = 0x7fff8a2386d0
	#14 0x00007fa17020d849 in OutputDevice::DrawRect(tools::Rectangle const&) (this=0x5589006636b0, rRect=...) at libreoffice/vcl/source/outdev/rect.cxx:67
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawRect(const tools::Rectangle&)"
		aRect = {static RECT_EMPTY = -32767, mnLeft = 0, mnTop = 0, mnRight = 10244, mnBottom = 269}
	#15 0x00007fa17021d997 in OutputDevice::DrawColorWallpaper(long, long, long, long, Wallpaper const&) (this=0x5589006636b0, nX=0, nY=0, nWidth=10245, nHeight=270, rWallpaper=...) at libreoffice/vcl/source/outdev/wallpaper.cxx:90
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawColorWallpaper(tools::Long, tools::Long, tools::Long, tools::Long, const Wallpaper&)"
		aOldLineColor = {{mValue = 0, {B = 0 '\000', G = 0 '\000', R = 0 '\000', T = 0 '\000'}}}
		aOldFillColor = {{mValue = 16777215, {B = 255 '\377', G = 255 '\377', R = 255 '\377', T = 0 '\000'}}}
		bMap = false
	#16 0x00007fa17021d851 in OutputDevice::DrawWallpaper(long, long, long, long, Wallpaper const&) (this=0x5589006636b0, nX=0, nY=0, nWidth=10245, nHeight=270, rWallpaper=...) at libreoffice/vcl/source/outdev/wallpaper.cxx:73
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawWallpaper(tools::Long, tools::Long, tools::Long, tools::Long, const Wallpaper&)"
	#17 0x00007fa17021daa8 in OutputDevice::Erase() (this=0x5589006636b0) at libreoffice/vcl/source/outdev/wallpaper.cxx:106
		eRasterOp = RasterOp::OverPaint
	#18 0x00007fa17055c716 in VirtualDevice::InnerImplSetOutputSizePixel(Size const&, bool, unsigned char*) (this=0x5589006636b0, rNewSize=..., bErase=true, pBuffer=0x0) at libreoffice/vcl/source/gdi/virdev.cxx:292
		bRet = true
		nNewWidth = 10245
		nNewHeight = 270
		__PRETTY_FUNCTION__ = "bool VirtualDevice::InnerImplSetOutputSizePixel(const Size&, bool, sal_uInt8*)"
	#19 0x00007fa17055cbf5 in VirtualDevice::ImplSetOutputSizePixel(Size const&, bool, unsigned char*) (this=0x5589006636b0, rNewSize=..., bErase=true, pBuffer=0x0) at libreoffice/vcl/source/gdi/virdev.cxx:360
	#20 0x00007fa17055ceba in VirtualDevice::SetOutputSizePixel(Size const&, bool) (this=0x5589006636b0, rNewSize=..., bErase=true) at libreoffice/vcl/source/gdi/virdev.cxx:408
	#21 0x00007fa16fea3ca4 in VirtualDevice::SetOutputSize(Size const&) (this=0x5589006636b0, rNewSize=...) at libreoffice/include/vcl/virdev.hxx:163
	#22 0x00007fa16fe96388 in VclDrawingArea::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fe9ba320, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:3092
		pDevice = {<ScopedVclPtr<VirtualDevice>> = {<VclPtr<VirtualDevice>> = {m_rInnerRef = {m_pBody = 0x5589006636b0}}, <No data fields>}, <No data fields>}
		pRefDevice = 0x5588ff474fd0
		aRenderSize = {<Pair> = {mnA = 10245, mnB = 270}, <No data fields>}
		aOutputSize = {<Pair> = {mnA = 683, mnB = 18}, <No data fields>}
		aRect = {static RECT_EMPTY = -32767, mnLeft = 140735510973440, mnTop = 140331342376707, mnRight = 140735510973456, mnBottom = 94046886702440}
		aImage = {maBitmap = {_vptr.Bitmap = 0x7fff8a238c20, mxSalBmp = std::shared_ptr<class SalBitmap> (empty) = {get() = 0x7fa16fd029cc <std::__uniq_ptr_impl<WindowImpl, std::default_delete<WindowImpl> >::_M_ptr() const+28>}, maPrefMapMode = {mpImplMapMode = {m_pimpl = 0x7fff8a238d60}}, maPrefSize = {<Pair> = {mnA = 94046793857224, mnB = 140331516265348}, <No data fields>}}, maAlphaMask = {_vptr.Bitmap = 0x0, mxSalBmp = std::shared_ptr<class SalBitmap> (use count 1875914999, weak count 32672) = {get() = 0x5588ff46fa98}, maPrefMapMode = {mpImplMapMode = {m_pimpl = 0x7fa16fd030f7 <std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> >::_M_head(std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> > const&)+28>}}, maPrefSize = {<Pair> = {mnA = 94046793857224, mnB = 94046886754968}, <No data fields>}}, maBitmapSize = {<Pair> = {mnA = 140735510973568, mnB = 140331342377207}, <No data fields>}}
		aOStm = {<SvStream> = {_vptr.SvStream = 0x2ab, m_xLockBytes = {pObj = 0x12}, m_nActPos = 140735510973600, m_pRWBuf = std::unique_ptr<unsigned char []> = {get() = 0x7fa16fd03026 <std::__get_helper<0ul, WindowImpl*, std::default_delete<WindowImpl> >(std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> > const&)+28> "\311\303\363\017\036\372UH\211\345H\203\354\020H\211}\370H\213E\370H\211\307", <incomplete sequence \350\265>}, m_pBufPos = 0x7fff8a238cb0 "\340\214#\212\024", m_nBufSize = 64152, m_nBufActualLen = 65350, m_nBufActualPos = 21896, m_nBufFree = 0, m_isIoRead = 192, m_isIoWrite = 140, m_isDirty = 35, m_isSwap = 138, m_isEof = 255, m_nError = {m_value = 1875914499}, m_nCompressMode = (SvStreamCompressFlags::ZBITMAP | unknown: 0x7fa0), m_eLineDelimiter = (unknown: 0x8a238ce0), m_eStreamCharSet = 20, m_aCryptMaskKey = {pData = 0x5588ff46fa98}, m_nCryptMask = 224 '\340', m_nVersion = 16, m_nBufFilePos = 140735510975776, m_eStreamMode = 2317587744, m_isWritable = 255}, nSize = 140735510973776, nResize = 28087389472, nPos = 140735510975776, nEndOfData = 140735510975776, pBuf = 0x7fff8a238d58 " \225#\212\377\177", bOwnsData = 32}
	#23 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fa90, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -12124904
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fe9ba320
		pAccLabelFor = 0x7fff8a238de0
		pAccLabelledBy = 0x68a238db0
	#24 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fa90, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#25 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fd10, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -12221224
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff46fa90
		pAccLabelFor = 0x7fff8a238e58
		pAccLabelledBy = 0x7fff8a238e20
	#26 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff462d60, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = -1
		nTop = -1
		nWidth = 1
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff46fd10
		pAccLabelFor = 0x5588ff458838
		pAccLabelledBy = 0x7fff8a238e90
	#27 0x00007fa16fe8fecd in VclScrolledWindow::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff462d60, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:2184
	#28 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff458830, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -12220472
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff462d60
		pAccLabelFor = 0x7fff8a238fb0
		pAccLabelledBy = 0x68a238f80
	#29 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff458830, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#30 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff4587c0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -18974136
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff458830
		pAccLabelFor = 0x7fff8a239040
		pAccLabelledBy = 0x68a239010
	#31 0x00007fa16fe8becd in VclGrid::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff4587c0, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:1406
	#32 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fede7a40, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -22893640
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff4587c0
		pAccLabelFor = 0x7fff8a2390d0
		pAccLabelledBy = 0x68a2390a0
	#33 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fede7a40, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#34 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fea2abb0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977380544
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fede7a40
		pAccLabelFor = 0x7fff8a239148
		pAccLabelledBy = 0x7fff8a239110
	#35 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588feddd8a0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 0
		nTop = 2049803913
		nWidth = 32673
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fea2abb0
		pAccLabelFor = 0x7fa16fcdc774 <__gnu_debug::_Safe_sequence_base::~_Safe_sequence_base()+28>
		pAccLabelledBy = 0x0
	#36 0x00007fa16ff6e15e in ToolBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588feddd8a0, rJsonWriter=...) at libreoffice/vcl/source/window/toolbox2.cxx:1713
		childrenNode = {mrWriter = @0x7fa16fd6409c}
	#37 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fee04430, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = -1
		nTop = -1
		nWidth = 1
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588feddd8a0
		pAccLabelFor = 0x7fff8a2393c8
		pAccLabelledBy = 0x7fff8a239390
	#38 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff2738a0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977379792
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fee04430
		pAccLabelFor = 0x7fff8a239438
		pAccLabelledBy = 0x7fff8a239400
	#39 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fedbafd0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977379680
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff2738a0
		pAccLabelFor = 0x7fff8a2394a8
		pAccLabelledBy = 0x7fff8a239470
	#40 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fedc2d50, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 21896
		nTop = 2045399353
		nWidth = 32673
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fedbafd0
		pAccLabelFor = 0x7fff8a239520
		pAccLabelledBy = 0x7fff8a2394e0
	#41 0x00007fa170764efa in vcl::lok::dumpState(rtl::OStringBuffer&) (rState=...) at libreoffice/vcl/source/app/svapp.cxx:1868
		props = {mpBuffer = 0x5588ff911780 "{ \"id\": \"\", \"type\": \"borderwindow\", \"text\": \"hello-world.ods - Collabora OfficeDev Calc 23.05 [ebacfb1]\", \"enabled\": true, \"children\": [ { \"id\": \"\", \"type\": \"workwindo"..., mPos = 0x5588ff912c3c "", mSpaceAllocated = 8244, mStartNodeCount = 24, mbFirstFieldInNode = false, static JSON_WRITER_DEBUG_MARKER = 222 '\336'}
		pSVData = 0x7fa171f3aea0 <rtl::Static<ImplSVData, (anonymous namespace)::private_aImplSVData>::get()::instance>
		pWin = 0x5588fedc2d50
	#42 0x00007fa179b08219 in desktop::LibLibreOffice_Impl::dumpState(rtl::OStringBuffer&) (this=0x5588fa5a7710, rState=...) at libreoffice/desktop/source/lib/init.cxx:5105
	#43 0x00007fa179b08002 in lo_dumpState(LibreOfficeKit*, char const*, char**) (pThis=0x5588fa5a7710, pState=0x7fff8a239630) at libreoffice/desktop/source/lib/init.cxx:5086
		aState = {pData = 0x5588ffa27670, nCapacity = 1048576}
		pLib = 0x5588fa5a7710
		aStr = {pData = 0x5588ff9bfd30}
	#44 0x00005588f9b2e947 in lok::Office::dumpState(char const*, char**) (pState=0x7fff8a239630, pOption=0x5588f9bd5e4d "", this=<optimized out>) at libreoffice/include/LibreOfficeKit/LibreOfficeKit.hxx:1149
		pState = 0x0

Change-Id: Icc5910238656566479ea0796c25779866ff8ec7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162794
Tested-by: Jenkins CollaboraOffice <[email protected]>
Reviewed-by: Michael Meeks <[email protected]>
(cherry picked from commit f4fa41c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162815
Reviewed-by: Caolán McNamara <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Jan 31, 2024
…n assert

so disable the SolarMutex checks during dumpState and restore afterwards

	#8  0x00007fa179e287f3 in abort () at /lib/x86_64-linux-gnu/libc.so.6
	#9  0x00007fa179e2871b in  () at /lib/x86_64-linux-gnu/libc.so.6
	#10 0x00007fa179e39e96 in  () at /lib/x86_64-linux-gnu/libc.so.6
	#11 0x00007fa1706904de in ImplDbgTestSolarMutex() () at libreoffice/vcl/source/app/dbggui.cxx:35
		__PRETTY_FUNCTION__ = "void ImplDbgTestSolarMutex()"
	#12 0x00007fa1782cb713 in DbgTestSolarMutex() () at libreoffice/tools/source/debug/debug.cxx:54
	#13 0x00007fa170559ebb in VirtualDevice::AcquireGraphics() const (this=0x5589006636b0) at libreoffice/vcl/source/gdi/virdev.cxx:49
		pSVData = 0x7fff8a2386d0
	#14 0x00007fa17020d849 in OutputDevice::DrawRect(tools::Rectangle const&) (this=0x5589006636b0, rRect=...) at libreoffice/vcl/source/outdev/rect.cxx:67
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawRect(const tools::Rectangle&)"
		aRect = {static RECT_EMPTY = -32767, mnLeft = 0, mnTop = 0, mnRight = 10244, mnBottom = 269}
	#15 0x00007fa17021d997 in OutputDevice::DrawColorWallpaper(long, long, long, long, Wallpaper const&) (this=0x5589006636b0, nX=0, nY=0, nWidth=10245, nHeight=270, rWallpaper=...) at libreoffice/vcl/source/outdev/wallpaper.cxx:90
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawColorWallpaper(tools::Long, tools::Long, tools::Long, tools::Long, const Wallpaper&)"
		aOldLineColor = {{mValue = 0, {B = 0 '\000', G = 0 '\000', R = 0 '\000', T = 0 '\000'}}}
		aOldFillColor = {{mValue = 16777215, {B = 255 '\377', G = 255 '\377', R = 255 '\377', T = 0 '\000'}}}
		bMap = false
	#16 0x00007fa17021d851 in OutputDevice::DrawWallpaper(long, long, long, long, Wallpaper const&) (this=0x5589006636b0, nX=0, nY=0, nWidth=10245, nHeight=270, rWallpaper=...) at libreoffice/vcl/source/outdev/wallpaper.cxx:73
		__PRETTY_FUNCTION__ = "void OutputDevice::DrawWallpaper(tools::Long, tools::Long, tools::Long, tools::Long, const Wallpaper&)"
	#17 0x00007fa17021daa8 in OutputDevice::Erase() (this=0x5589006636b0) at libreoffice/vcl/source/outdev/wallpaper.cxx:106
		eRasterOp = RasterOp::OverPaint
	#18 0x00007fa17055c716 in VirtualDevice::InnerImplSetOutputSizePixel(Size const&, bool, unsigned char*) (this=0x5589006636b0, rNewSize=..., bErase=true, pBuffer=0x0) at libreoffice/vcl/source/gdi/virdev.cxx:292
		bRet = true
		nNewWidth = 10245
		nNewHeight = 270
		__PRETTY_FUNCTION__ = "bool VirtualDevice::InnerImplSetOutputSizePixel(const Size&, bool, sal_uInt8*)"
	#19 0x00007fa17055cbf5 in VirtualDevice::ImplSetOutputSizePixel(Size const&, bool, unsigned char*) (this=0x5589006636b0, rNewSize=..., bErase=true, pBuffer=0x0) at libreoffice/vcl/source/gdi/virdev.cxx:360
	#20 0x00007fa17055ceba in VirtualDevice::SetOutputSizePixel(Size const&, bool) (this=0x5589006636b0, rNewSize=..., bErase=true) at libreoffice/vcl/source/gdi/virdev.cxx:408
	#21 0x00007fa16fea3ca4 in VirtualDevice::SetOutputSize(Size const&) (this=0x5589006636b0, rNewSize=...) at libreoffice/include/vcl/virdev.hxx:163
	#22 0x00007fa16fe96388 in VclDrawingArea::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fe9ba320, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:3092
		pDevice = {<ScopedVclPtr<VirtualDevice>> = {<VclPtr<VirtualDevice>> = {m_rInnerRef = {m_pBody = 0x5589006636b0}}, <No data fields>}, <No data fields>}
		pRefDevice = 0x5588ff474fd0
		aRenderSize = {<Pair> = {mnA = 10245, mnB = 270}, <No data fields>}
		aOutputSize = {<Pair> = {mnA = 683, mnB = 18}, <No data fields>}
		aRect = {static RECT_EMPTY = -32767, mnLeft = 140735510973440, mnTop = 140331342376707, mnRight = 140735510973456, mnBottom = 94046886702440}
		aImage = {maBitmap = {_vptr.Bitmap = 0x7fff8a238c20, mxSalBmp = std::shared_ptr<class SalBitmap> (empty) = {get() = 0x7fa16fd029cc <std::__uniq_ptr_impl<WindowImpl, std::default_delete<WindowImpl> >::_M_ptr() const+28>}, maPrefMapMode = {mpImplMapMode = {m_pimpl = 0x7fff8a238d60}}, maPrefSize = {<Pair> = {mnA = 94046793857224, mnB = 140331516265348}, <No data fields>}}, maAlphaMask = {_vptr.Bitmap = 0x0, mxSalBmp = std::shared_ptr<class SalBitmap> (use count 1875914999, weak count 32672) = {get() = 0x5588ff46fa98}, maPrefMapMode = {mpImplMapMode = {m_pimpl = 0x7fa16fd030f7 <std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> >::_M_head(std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> > const&)+28>}}, maPrefSize = {<Pair> = {mnA = 94046793857224, mnB = 94046886754968}, <No data fields>}}, maBitmapSize = {<Pair> = {mnA = 140735510973568, mnB = 140331342377207}, <No data fields>}}
		aOStm = {<SvStream> = {_vptr.SvStream = 0x2ab, m_xLockBytes = {pObj = 0x12}, m_nActPos = 140735510973600, m_pRWBuf = std::unique_ptr<unsigned char []> = {get() = 0x7fa16fd03026 <std::__get_helper<0ul, WindowImpl*, std::default_delete<WindowImpl> >(std::_Tuple_impl<0ul, WindowImpl*, std::default_delete<WindowImpl> > const&)+28> "\311\303\363\017\036\372UH\211\345H\203\354\020H\211}\370H\213E\370H\211\307", <incomplete sequence \350\265>}, m_pBufPos = 0x7fff8a238cb0 "\340\214#\212\024", m_nBufSize = 64152, m_nBufActualLen = 65350, m_nBufActualPos = 21896, m_nBufFree = 0, m_isIoRead = 192, m_isIoWrite = 140, m_isDirty = 35, m_isSwap = 138, m_isEof = 255, m_nError = {m_value = 1875914499}, m_nCompressMode = (SvStreamCompressFlags::ZBITMAP | unknown: 0x7fa0), m_eLineDelimiter = (unknown: 0x8a238ce0), m_eStreamCharSet = 20, m_aCryptMaskKey = {pData = 0x5588ff46fa98}, m_nCryptMask = 224 '\340', m_nVersion = 16, m_nBufFilePos = 140735510975776, m_eStreamMode = 2317587744, m_isWritable = 255}, nSize = 140735510973776, nResize = 28087389472, nPos = 140735510975776, nEndOfData = 140735510975776, pBuf = 0x7fff8a238d58 " \225#\212\377\177", bOwnsData = 32}
	#23 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fa90, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -12124904
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fe9ba320
		pAccLabelFor = 0x7fff8a238de0
		pAccLabelledBy = 0x68a238db0
	#24 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fa90, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#25 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff46fd10, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -12221224
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff46fa90
		pAccLabelFor = 0x7fff8a238e58
		pAccLabelledBy = 0x7fff8a238e20
	#26 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff462d60, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = -1
		nTop = -1
		nWidth = 1
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff46fd10
		pAccLabelFor = 0x5588ff458838
		pAccLabelledBy = 0x7fff8a238e90
	#27 0x00007fa16fe8fecd in VclScrolledWindow::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff462d60, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:2184
	#28 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff458830, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -12220472
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff462d60
		pAccLabelFor = 0x7fff8a238fb0
		pAccLabelledBy = 0x68a238f80
	#29 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff458830, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#30 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff4587c0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -18974136
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff458830
		pAccLabelFor = 0x7fff8a239040
		pAccLabelledBy = 0x68a239010
	#31 0x00007fa16fe8becd in VclGrid::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff4587c0, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:1406
	#32 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fede7a40, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 20
		nTop = -22893640
		nWidth = 21896
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff4587c0
		pAccLabelFor = 0x7fff8a2390d0
		pAccLabelledBy = 0x68a2390a0
	#33 0x00007fa16fe86709 in VclBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fede7a40, rJsonWriter=...) at libreoffice/vcl/source/window/layout.cxx:398
	#34 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fea2abb0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977380544
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fede7a40
		pAccLabelFor = 0x7fff8a239148
		pAccLabelledBy = 0x7fff8a239110
	#35 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588feddd8a0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 0
		nTop = 2049803913
		nWidth = 32673
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fea2abb0
		pAccLabelFor = 0x7fa16fcdc774 <__gnu_debug::_Safe_sequence_base::~_Safe_sequence_base()+28>
		pAccLabelledBy = 0x0
	#36 0x00007fa16ff6e15e in ToolBox::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588feddd8a0, rJsonWriter=...) at libreoffice/vcl/source/window/toolbox2.cxx:1713
		childrenNode = {mrWriter = @0x7fa16fd6409c}
	#37 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fee04430, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = -1
		nTop = -1
		nWidth = 1
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588feddd8a0
		pAccLabelFor = 0x7fff8a2393c8
		pAccLabelledBy = 0x7fff8a239390
	#38 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588ff2738a0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977379792
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fee04430
		pAccLabelFor = 0x7fff8a239438
		pAccLabelledBy = 0x7fff8a239400
	#39 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fedbafd0, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 32767
		nTop = -1977379680
		nWidth = 32767
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588ff2738a0
		pAccLabelFor = 0x7fff8a2394a8
		pAccLabelledBy = 0x7fff8a239470
	#40 0x00007fa16ffbcaba in vcl::Window::DumpAsPropertyTree(tools::JsonWriter&) (this=0x5588fedc2d50, rJsonWriter=...) at libreoffice/vcl/source/window/window.cxx:3388
		childNode = {mrWriter = @0x7fff8a239520}
		nLeft = 21896
		nTop = 2045399353
		nWidth = 32673
		childrenNode = {mrWriter = @0x7fff8a239520}
		pChild = 0x5588fedbafd0
		pAccLabelFor = 0x7fff8a239520
		pAccLabelledBy = 0x7fff8a2394e0
	#41 0x00007fa170764efa in vcl::lok::dumpState(rtl::OStringBuffer&) (rState=...) at libreoffice/vcl/source/app/svapp.cxx:1868
		props = {mpBuffer = 0x5588ff911780 "{ \"id\": \"\", \"type\": \"borderwindow\", \"text\": \"hello-world.ods - Collabora OfficeDev Calc 23.05 [ebacfb1]\", \"enabled\": true, \"children\": [ { \"id\": \"\", \"type\": \"workwindo"..., mPos = 0x5588ff912c3c "", mSpaceAllocated = 8244, mStartNodeCount = 24, mbFirstFieldInNode = false, static JSON_WRITER_DEBUG_MARKER = 222 '\336'}
		pSVData = 0x7fa171f3aea0 <rtl::Static<ImplSVData, (anonymous namespace)::private_aImplSVData>::get()::instance>
		pWin = 0x5588fedc2d50
	#42 0x00007fa179b08219 in desktop::LibLibreOffice_Impl::dumpState(rtl::OStringBuffer&) (this=0x5588fa5a7710, rState=...) at libreoffice/desktop/source/lib/init.cxx:5105
	#43 0x00007fa179b08002 in lo_dumpState(LibreOfficeKit*, char const*, char**) (pThis=0x5588fa5a7710, pState=0x7fff8a239630) at libreoffice/desktop/source/lib/init.cxx:5086
		aState = {pData = 0x5588ffa27670, nCapacity = 1048576}
		pLib = 0x5588fa5a7710
		aStr = {pData = 0x5588ff9bfd30}
	#44 0x00005588f9b2e947 in lok::Office::dumpState(char const*, char**) (pState=0x7fff8a239630, pOption=0x5588f9bd5e4d "", this=<optimized out>) at libreoffice/include/LibreOfficeKit/LibreOfficeKit.hxx:1149
		pState = 0x0

Change-Id: Icc5910238656566479ea0796c25779866ff8ec7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162794
Tested-by: Jenkins CollaboraOffice <[email protected]>
Reviewed-by: Michael Meeks <[email protected]>
(cherry picked from commit f4fa41c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162816
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 10, 2024
In `SwTransferable::RemoveDDELinkFormat`, only update the
clipboard content with this `SwTransferable` after removing
the `SotClipboardFormatId::LINK` from the supported formats
if the `SwTransferable` was the clipboard content before
already.

Doing so always would unrelatedly overwrite what was previously
copied from another application to the clipboard for the
tdf#158947 scenario of pasting clipboard content of another
application over a selection when using the Qt-based VCL plugins
on Wayland (s. backtrace below that shows how the clipboard content
was overwritten, frame #17 is the method changed in this
commit).

My assumption why the clipboard content is explicitly overwritten
at all is to make sure that the system clipboard on some platforms
gets notified about the change in supported formats/mime
types after removing one. But that isn't necessary when the
transfer data modified here aren't the current clipboard content
in the first place.

Backtrace for how clipboard content was previously overwritten
for the tdf#158947 scenario with the qt6 VCL plugin on Wayland:

    ~"#0  QtClipboard::handleChanged(QClipboard::Mode) (this=0x557f90457770, aMode=QClipboard::Clipboard) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:156\n"
    ~"#1  0x00007f26f08844ff in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}::operator()() const (__closure=0x7ffe889a2c20) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:153\n"
    ~"#2  0x00007f26f0884ffb in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}>(void**, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}&&) (args=0x7ffe889a2ed0, fn=...) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:72\n"
    ~"#3  0x00007f26f088456f in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:152\n"
    ~"#4  0x00007f26f08833de in QtPrivate::FunctionPointer<void (QtClipboard::*)(QClipboard::Mode)>::call<QtPrivate::List<QClipboard::Mode>, void>(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:200\n"
    ~"#5  0x00007f26f0881f71 in QtPrivate::QCallableObject<void (QtClipboard::*)(QClipboard::Mode), QtPrivate::List<QClipboard::Mode>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0, ret=0x0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:571\n"
    ~"#6  0x00007f26efdb863f in QtPrivate::QSlotObjectBase::call(QObject*, void**) (this=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:487\n"
    ~"#7  0x00007f26efe5772e in doActivate<false>(QObject*, int, void**) (sender=0x557f8d510fd0, signal_index=3, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4116\n"
    ~"#8  0x00007f26efe4cdef in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=0x557f8d510fd0, m=0x7f26efa47cc0 <QClipboard::staticMetaObject>, local_signal_index=0, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4176\n"
    ~"#9  0x00007f26eede9fcc in QClipboard::changed(QClipboard::Mode) (this=0x557f8d510fd0, _t1=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/Gui_autogen/include/moc_qclipboard.cpp:182\n"
    ~"#10 0x00007f26eede9bc1 in QClipboard::emitChanged(QClipboard::Mode) (this=0x557f8d510fd0, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:558\n"
    ~"#11 0x00007f26eee4ed69 in QPlatformClipboard::emitChanged(QClipboard::Mode) (this=0x557f88019c20, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qplatformclipboard.cpp:89\n"
    ~"#12 0x00007f26ed78809e in QtWaylandClient::QWaylandClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f88019c20, data=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtwayland/src/client/qwaylandclipboard.cpp:89\n"
    ~"#13 0x00007f26eede99de in QClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f8d510fd0, src=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:447\n"
    ~"#14 0x00007f26f087a5b5 in QtClipboard::setContents(com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable> const&, com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboardOwner> const&) (this=0x557f8d50cbb0, xTrans=uno::Reference to (SwTransferable *) 0x557f90440118, xClipboardOwner=uno::Reference to (SwTransferable *) 0x557f90440120) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:137\n"
    ~"#15 0x00007f26fb05bacc in TransferableHelper::CopyToClipboard(com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> const&) const (this=0x557f904400f0, rClipboard=uno::Reference to (QtClipboard *) 0x557f8d50cc10) at .../libreoffice/vcl/source/treelist/transfer.cxx:942\n"
    ~"#16 0x00007f26fb05bc77 in TransferableHelper::CopyToClipboard(vcl::Window*) const (this=0x557f904400f0, pWindow=0x557f8932d1f0) at .../libreoffice/vcl/source/treelist/transfer.cxx:957\n"
    ~"#17 0x00007f26b5130940 in SwTransferable::RemoveDDELinkFormat(vcl::Window&) (this=0x557f904400f0, rWin=...) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:385\n"
    ~"#18 0x00007f26b51440ab in SwTransferDdeLink::DataChanged(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x557f8fb864e0) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:4447\n"
    ~"#19 0x00007f270120fa0e in sfx2::SvLinkSource::NotifyDataChanged() (this=0x557f8fb8bbe0) at .../libreoffice/sfx2/source/appl/linksrc.cxx:291\n"
    ~"#20 0x00007f26b43210ba in SwServerObject::SendDataChanged(SwPaM const&) (this=0x557f8fb8bbe0, rRange=SwPaM = {...}) at .../libreoffice/sw/source/core/doc/swserv.cxx:177\n"
    ~"#21 0x00007f26b43217c2 in SwDataChanged::~SwDataChanged() (this=0x7ffe889a3520, __in_chrg=<optimized out>) at .../libreoffice/sw/source/core/doc/swserv.cxx:308\n"
    ~"#22 0x00007f26b4233c8b in sw::DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4474\n"
    ~"#23 0x00007f26b4233826 in sw::DocumentContentOperationsManager::DeleteRangeImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4419\n"
    ~"#24 0x00007f26b4233681 in sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4391\n"
    ~"#25 0x00007f26b421edb7 in (anonymous namespace)::lcl_DoWithBreaks(sw::DocumentContentOperationsManager&, SwPaM&, SwDeleteFlags, bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager* const, SwPaM&, SwDeleteFlags)) (rDocumentContentOperations=..., rPam=SwPaM = {...}, flags=SwDeleteFlags::Default, pFunc=(bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager * const, SwPaM &, SwDeleteFlags)) 0x7f26b4233632 <sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags)>) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:681\n"
    ~"#26 0x00007f26b42279df in sw::DocumentContentOperationsManager::DeleteAndJoin(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:2367\n"
    ~"#27 0x00007f26b44a71f6 in SwEditShell::DeleteSel(SwPaM&, bool, bool, bool*) (this=0x557f8d51b300, rPam=SwPaM = {...}, isArtificialSelection=false, goLeft=false, pUndo=0x7ffe889a3be6) at .../libreoffice/sw/source/core/edit/eddel.cxx:122\n"
    ~"#28 0x00007f26b44a7671 in SwEditShell::Delete(bool, bool) (this=0x557f8d51b300, isArtificialSelection=false, goLeft=false) at .../libreoffice/sw/source/core/edit/eddel.cxx:164\n"
    ~"#29 0x00007f26b5604933 in SwWrtShell::DelRight(bool) (this=0x557f8d51b300, isReplaceHeuristic=false) at .../libreoffice/sw/source/uibase/wrtsh/delete.cxx:312\n"
    ~"#30 0x00007f26b512fe14 in (anonymous namespace)::SwTrnsfrActionAndUndo::SwTrnsfrActionAndUndo(SwWrtShell*, bool, SwPasteContext*) (this=0x557f9045b020, pS=0x557f8d51b300, bDelSel=true, pContext=0x7ffe889a4220) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:236\n"
    ~"#31 0x00007f26b51377c1 in SwTransferable::PasteData(TransferableDataHelper const&, SwWrtShell&, unsigned char, SotExchangeActionFlags, SotClipboardFormatId, SotExchangeDest, bool, bool, Point const*, signed char, bool, RndStdIds, bool, SwPasteContext*, PasteTableType) (rData=..., rSh=..., nAction=36 '$', nActionFlags=(SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl), nFormat=SotClipboardFormatId::HTML, nDestination=SotExchangeDest::SWDOC_FREE_AREA, bIsPasteFormat=false, bIsDefault=false, pPt=0x0, nDropAction=0 '\\000', bPasteSelection=false, nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, pContext=0x7ffe889a4220, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1768\n"
    ~"#32 0x00007f26b5137333 in SwTransferable::Paste(SwWrtShell&, TransferableDataHelper&, RndStdIds, bool, PasteTableType) (rSh=..., rData=..., nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1687\n"
    ~"#33 0x00007f26b52d29e9 in SwBaseShell::ExecClpbrd(SfxRequest&) (this=0x557f8db64330, rReq=...) at .../libreoffice/sw/source/uibase/shells/basesh.cxx:365\n"
    ~"#34 0x00007f26b52d1681 in SfxStubSwBaseShellExecClpbrd(SfxShell*, SfxRequest&) (pShell=0x557f8db64330, rReq=...) at .../libreoffice/workdir/SdiTarget/sw/sdi/swslots.hxx:2219\n"
    ~"#35 0x00007f27012d14dc in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., bRecord=true) at .../libreoffice/sfx2/source/control/dispatch.cxx:254\n"
    ~"#36 0x00007f27012d4b34 in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., eCallMode=SfxCallMode::RECORD) at .../libreoffice/sfx2/source/control/dispatch.cxx:753\n"
    ~"#37 0x00007f27012c05d4 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) (this=0x557f8d503240, aReq=..., pSlot=0x7f26b6cf5360 <aSwBaseShellSlots_Impl+1440>, pShell=0x557f8db64330) at .../libreoffice/sfx2/source/control/bindings.cxx:1057\n"
    ~"#38 0x00007f270139813d in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) (this=0x557f8db682a0, aURL=..., aArgs=empty uno::Sequence, rListener=empty uno::Reference) at .../libreoffice/sfx2/source/control/unoctitm.cxx:688\n"
    ~"#39 0x00007f2701395dbf in SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x557f8db68200, aURL=..., aArgs=empty uno::Sequence) at .../libreoffice/sfx2/source/control/unoctitm.cxx:250\n"
    ~"#40 0x00007f26fe03d948 in svt::(anonymous namespace)::AsyncAccelExec::impl_ts_asyncCallback(LinkParamNone*) (this=0x557f8fb8e070) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:508\n"
    ~"#41 0x00007f26fe03d869 in svt::(anonymous namespace)::AsyncAccelExec::LinkStubimpl_ts_asyncCallback(void*, LinkParamNone*) (instance=0x557f8fb8e070, data=0x0) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:500\n"
    ~"#42 0x00007f26fab0db3b in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x557f8fb8e110, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#43 0x00007f26fb469f3d in vcl::EventPoster::DoEvent_Impl(void*) (this=0x557f8fb8e108) at .../libreoffice/vcl/source/helper/evntpost.cxx:52\n"
    ~"#44 0x00007f26fb469f05 in vcl::EventPoster::LinkStubDoEvent_Impl(void*, void*) (instance=0x557f8fb8e108, data=0x0) at .../libreoffice/vcl/source/helper/evntpost.cxx:48\n"
    ~"#45 0x00007f26fadc2373 in Link<void*, void>::Call(void*) const (this=0x7f26e80153b8, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#46 0x00007f26fadbf458 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2287\n"
    ~"#47 0x00007f26fadc1385 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x557f897d0e90, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2851\n"
    ~"#48 0x00007f26f08b6bae in SalFrame::CallCallback(SalEvent, void const*) const (this=0x557f8800cf80, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/inc/salframe.hxx:310\n"
    ~"#49 0x00007f26f08d9dbf in QtInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x557f88020780, aEvent=...) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:516\n"
    ~"#50 0x00007f26fb47b97f in operator()() const (__closure=0x7ffe889a50e0) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119\n"
    ~"#51 0x00007f26fb47bc53 in SalUserEventList::DispatchUserEvents(bool) (this=0x557f880207b8, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120\n"
    ~"#52 0x00007f26f08d98a4 in QtInstance::ImplYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:442\n"
    ~"#53 0x00007f26f08d9a4f in QtInstance::DoYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464\n"
    ~"#54 0x00007f26fb5390d0 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390\n"
    ~"#55 0x00007f26fb539e6e in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:474\n"
    ~"#56 0x00007f26fb538dc3 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:368\n"
    ~"#57 0x00007f2704e371b6 in desktop::Desktop::Main() (this=0x7ffe889a5c10) at .../libreoffice/desktop/source/app/app.cxx:1614\n"
    ~"#58 0x00007f26fb558292 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229\n"
    ~"#59 0x00007f26fb5585a7 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261\n"
    ~"#60 0x00007f2704ea4307 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94\n"
    ~"#61 0x0000557f862d19d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51\n"
    ~"#62 0x0000557f862d19ba in main (argc=3, argv=0x7ffe889a5e38) at .../libreoffice/desktop/source/app/main.c:49\n"
    2906^done
    (gdb)

Change-Id: I1f517d441eeb3e77e969062b884d9a425038b22a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163202
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 12, 2024
In `SwTransferable::RemoveDDELinkFormat`, only update the
clipboard content with this `SwTransferable` after removing
the `SotClipboardFormatId::LINK` from the supported formats
if the `SwTransferable` was the clipboard content before
already.

Doing so always would unrelatedly overwrite what was previously
copied from another application to the clipboard for the
tdf#158947 scenario of pasting clipboard content of another
application over a selection when using the Qt-based VCL plugins
on Wayland (s. backtrace below that shows how the clipboard content
was overwritten, frame #17 is the method changed in this
commit).

My assumption why the clipboard content is explicitly overwritten
at all is to make sure that the system clipboard on some platforms
gets notified about the change in supported formats/mime
types after removing one. But that isn't necessary when the
transfer data modified here aren't the current clipboard content
in the first place.

Backtrace for how clipboard content was previously overwritten
for the tdf#158947 scenario with the qt6 VCL plugin on Wayland:

    ~"#0  QtClipboard::handleChanged(QClipboard::Mode) (this=0x557f90457770, aMode=QClipboard::Clipboard) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:156\n"
    ~"#1  0x00007f26f08844ff in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}::operator()() const (__closure=0x7ffe889a2c20) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:153\n"
    ~"#2  0x00007f26f0884ffb in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}>(void**, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}&&) (args=0x7ffe889a2ed0, fn=...) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:72\n"
    ~"#3  0x00007f26f088456f in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:152\n"
    ~"#4  0x00007f26f08833de in QtPrivate::FunctionPointer<void (QtClipboard::*)(QClipboard::Mode)>::call<QtPrivate::List<QClipboard::Mode>, void>(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:200\n"
    ~"#5  0x00007f26f0881f71 in QtPrivate::QCallableObject<void (QtClipboard::*)(QClipboard::Mode), QtPrivate::List<QClipboard::Mode>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0, ret=0x0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:571\n"
    ~"#6  0x00007f26efdb863f in QtPrivate::QSlotObjectBase::call(QObject*, void**) (this=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:487\n"
    ~"#7  0x00007f26efe5772e in doActivate<false>(QObject*, int, void**) (sender=0x557f8d510fd0, signal_index=3, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4116\n"
    ~"#8  0x00007f26efe4cdef in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=0x557f8d510fd0, m=0x7f26efa47cc0 <QClipboard::staticMetaObject>, local_signal_index=0, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4176\n"
    ~"#9  0x00007f26eede9fcc in QClipboard::changed(QClipboard::Mode) (this=0x557f8d510fd0, _t1=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/Gui_autogen/include/moc_qclipboard.cpp:182\n"
    ~"#10 0x00007f26eede9bc1 in QClipboard::emitChanged(QClipboard::Mode) (this=0x557f8d510fd0, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:558\n"
    ~"#11 0x00007f26eee4ed69 in QPlatformClipboard::emitChanged(QClipboard::Mode) (this=0x557f88019c20, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qplatformclipboard.cpp:89\n"
    ~"#12 0x00007f26ed78809e in QtWaylandClient::QWaylandClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f88019c20, data=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtwayland/src/client/qwaylandclipboard.cpp:89\n"
    ~"#13 0x00007f26eede99de in QClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f8d510fd0, src=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:447\n"
    ~"#14 0x00007f26f087a5b5 in QtClipboard::setContents(com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable> const&, com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboardOwner> const&) (this=0x557f8d50cbb0, xTrans=uno::Reference to (SwTransferable *) 0x557f90440118, xClipboardOwner=uno::Reference to (SwTransferable *) 0x557f90440120) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:137\n"
    ~"#15 0x00007f26fb05bacc in TransferableHelper::CopyToClipboard(com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> const&) const (this=0x557f904400f0, rClipboard=uno::Reference to (QtClipboard *) 0x557f8d50cc10) at .../libreoffice/vcl/source/treelist/transfer.cxx:942\n"
    ~"#16 0x00007f26fb05bc77 in TransferableHelper::CopyToClipboard(vcl::Window*) const (this=0x557f904400f0, pWindow=0x557f8932d1f0) at .../libreoffice/vcl/source/treelist/transfer.cxx:957\n"
    ~"#17 0x00007f26b5130940 in SwTransferable::RemoveDDELinkFormat(vcl::Window&) (this=0x557f904400f0, rWin=...) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:385\n"
    ~"#18 0x00007f26b51440ab in SwTransferDdeLink::DataChanged(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x557f8fb864e0) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:4447\n"
    ~"#19 0x00007f270120fa0e in sfx2::SvLinkSource::NotifyDataChanged() (this=0x557f8fb8bbe0) at .../libreoffice/sfx2/source/appl/linksrc.cxx:291\n"
    ~"#20 0x00007f26b43210ba in SwServerObject::SendDataChanged(SwPaM const&) (this=0x557f8fb8bbe0, rRange=SwPaM = {...}) at .../libreoffice/sw/source/core/doc/swserv.cxx:177\n"
    ~"#21 0x00007f26b43217c2 in SwDataChanged::~SwDataChanged() (this=0x7ffe889a3520, __in_chrg=<optimized out>) at .../libreoffice/sw/source/core/doc/swserv.cxx:308\n"
    ~"#22 0x00007f26b4233c8b in sw::DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4474\n"
    ~"#23 0x00007f26b4233826 in sw::DocumentContentOperationsManager::DeleteRangeImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4419\n"
    ~"#24 0x00007f26b4233681 in sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4391\n"
    ~"#25 0x00007f26b421edb7 in (anonymous namespace)::lcl_DoWithBreaks(sw::DocumentContentOperationsManager&, SwPaM&, SwDeleteFlags, bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager* const, SwPaM&, SwDeleteFlags)) (rDocumentContentOperations=..., rPam=SwPaM = {...}, flags=SwDeleteFlags::Default, pFunc=(bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager * const, SwPaM &, SwDeleteFlags)) 0x7f26b4233632 <sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags)>) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:681\n"
    ~"#26 0x00007f26b42279df in sw::DocumentContentOperationsManager::DeleteAndJoin(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:2367\n"
    ~"#27 0x00007f26b44a71f6 in SwEditShell::DeleteSel(SwPaM&, bool, bool, bool*) (this=0x557f8d51b300, rPam=SwPaM = {...}, isArtificialSelection=false, goLeft=false, pUndo=0x7ffe889a3be6) at .../libreoffice/sw/source/core/edit/eddel.cxx:122\n"
    ~"#28 0x00007f26b44a7671 in SwEditShell::Delete(bool, bool) (this=0x557f8d51b300, isArtificialSelection=false, goLeft=false) at .../libreoffice/sw/source/core/edit/eddel.cxx:164\n"
    ~"#29 0x00007f26b5604933 in SwWrtShell::DelRight(bool) (this=0x557f8d51b300, isReplaceHeuristic=false) at .../libreoffice/sw/source/uibase/wrtsh/delete.cxx:312\n"
    ~"#30 0x00007f26b512fe14 in (anonymous namespace)::SwTrnsfrActionAndUndo::SwTrnsfrActionAndUndo(SwWrtShell*, bool, SwPasteContext*) (this=0x557f9045b020, pS=0x557f8d51b300, bDelSel=true, pContext=0x7ffe889a4220) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:236\n"
    ~"#31 0x00007f26b51377c1 in SwTransferable::PasteData(TransferableDataHelper const&, SwWrtShell&, unsigned char, SotExchangeActionFlags, SotClipboardFormatId, SotExchangeDest, bool, bool, Point const*, signed char, bool, RndStdIds, bool, SwPasteContext*, PasteTableType) (rData=..., rSh=..., nAction=36 '$', nActionFlags=(SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl), nFormat=SotClipboardFormatId::HTML, nDestination=SotExchangeDest::SWDOC_FREE_AREA, bIsPasteFormat=false, bIsDefault=false, pPt=0x0, nDropAction=0 '\\000', bPasteSelection=false, nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, pContext=0x7ffe889a4220, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1768\n"
    ~"#32 0x00007f26b5137333 in SwTransferable::Paste(SwWrtShell&, TransferableDataHelper&, RndStdIds, bool, PasteTableType) (rSh=..., rData=..., nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1687\n"
    ~"#33 0x00007f26b52d29e9 in SwBaseShell::ExecClpbrd(SfxRequest&) (this=0x557f8db64330, rReq=...) at .../libreoffice/sw/source/uibase/shells/basesh.cxx:365\n"
    ~"#34 0x00007f26b52d1681 in SfxStubSwBaseShellExecClpbrd(SfxShell*, SfxRequest&) (pShell=0x557f8db64330, rReq=...) at .../libreoffice/workdir/SdiTarget/sw/sdi/swslots.hxx:2219\n"
    ~"#35 0x00007f27012d14dc in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., bRecord=true) at .../libreoffice/sfx2/source/control/dispatch.cxx:254\n"
    ~"#36 0x00007f27012d4b34 in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., eCallMode=SfxCallMode::RECORD) at .../libreoffice/sfx2/source/control/dispatch.cxx:753\n"
    ~"#37 0x00007f27012c05d4 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) (this=0x557f8d503240, aReq=..., pSlot=0x7f26b6cf5360 <aSwBaseShellSlots_Impl+1440>, pShell=0x557f8db64330) at .../libreoffice/sfx2/source/control/bindings.cxx:1057\n"
    ~"#38 0x00007f270139813d in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) (this=0x557f8db682a0, aURL=..., aArgs=empty uno::Sequence, rListener=empty uno::Reference) at .../libreoffice/sfx2/source/control/unoctitm.cxx:688\n"
    ~"#39 0x00007f2701395dbf in SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x557f8db68200, aURL=..., aArgs=empty uno::Sequence) at .../libreoffice/sfx2/source/control/unoctitm.cxx:250\n"
    ~"#40 0x00007f26fe03d948 in svt::(anonymous namespace)::AsyncAccelExec::impl_ts_asyncCallback(LinkParamNone*) (this=0x557f8fb8e070) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:508\n"
    ~"#41 0x00007f26fe03d869 in svt::(anonymous namespace)::AsyncAccelExec::LinkStubimpl_ts_asyncCallback(void*, LinkParamNone*) (instance=0x557f8fb8e070, data=0x0) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:500\n"
    ~"#42 0x00007f26fab0db3b in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x557f8fb8e110, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#43 0x00007f26fb469f3d in vcl::EventPoster::DoEvent_Impl(void*) (this=0x557f8fb8e108) at .../libreoffice/vcl/source/helper/evntpost.cxx:52\n"
    ~"#44 0x00007f26fb469f05 in vcl::EventPoster::LinkStubDoEvent_Impl(void*, void*) (instance=0x557f8fb8e108, data=0x0) at .../libreoffice/vcl/source/helper/evntpost.cxx:48\n"
    ~"#45 0x00007f26fadc2373 in Link<void*, void>::Call(void*) const (this=0x7f26e80153b8, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#46 0x00007f26fadbf458 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2287\n"
    ~"#47 0x00007f26fadc1385 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x557f897d0e90, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2851\n"
    ~"#48 0x00007f26f08b6bae in SalFrame::CallCallback(SalEvent, void const*) const (this=0x557f8800cf80, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/inc/salframe.hxx:310\n"
    ~"#49 0x00007f26f08d9dbf in QtInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x557f88020780, aEvent=...) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:516\n"
    ~"#50 0x00007f26fb47b97f in operator()() const (__closure=0x7ffe889a50e0) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119\n"
    ~"#51 0x00007f26fb47bc53 in SalUserEventList::DispatchUserEvents(bool) (this=0x557f880207b8, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120\n"
    ~"#52 0x00007f26f08d98a4 in QtInstance::ImplYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:442\n"
    ~"#53 0x00007f26f08d9a4f in QtInstance::DoYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464\n"
    ~"#54 0x00007f26fb5390d0 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390\n"
    ~"#55 0x00007f26fb539e6e in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:474\n"
    ~"#56 0x00007f26fb538dc3 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:368\n"
    ~"#57 0x00007f2704e371b6 in desktop::Desktop::Main() (this=0x7ffe889a5c10) at .../libreoffice/desktop/source/app/app.cxx:1614\n"
    ~"#58 0x00007f26fb558292 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229\n"
    ~"#59 0x00007f26fb5585a7 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261\n"
    ~"#60 0x00007f2704ea4307 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94\n"
    ~"#61 0x0000557f862d19d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51\n"
    ~"#62 0x0000557f862d19ba in main (argc=3, argv=0x7ffe889a5e38) at .../libreoffice/desktop/source/app/main.c:49\n"
    2906^done
    (gdb)

Change-Id: I1f517d441eeb3e77e969062b884d9a425038b22a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163202
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit cb9513c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163179
Reviewed-by: Michael Stahl <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 16, 2024
In `SwTransferable::RemoveDDELinkFormat`, only update the
clipboard content with this `SwTransferable` after removing
the `SotClipboardFormatId::LINK` from the supported formats
if the `SwTransferable` was the clipboard content before
already.

Doing so always would unrelatedly overwrite what was previously
copied from another application to the clipboard for the
tdf#158947 scenario of pasting clipboard content of another
application over a selection when using the Qt-based VCL plugins
on Wayland (s. backtrace below that shows how the clipboard content
was overwritten, frame #17 is the method changed in this
commit).

My assumption why the clipboard content is explicitly overwritten
at all is to make sure that the system clipboard on some platforms
gets notified about the change in supported formats/mime
types after removing one. But that isn't necessary when the
transfer data modified here aren't the current clipboard content
in the first place.

Backtrace for how clipboard content was previously overwritten
for the tdf#158947 scenario with the qt6 VCL plugin on Wayland:

    ~"#0  QtClipboard::handleChanged(QClipboard::Mode) (this=0x557f90457770, aMode=QClipboard::Clipboard) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:156\n"
    ~"#1  0x00007f26f08844ff in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}::operator()() const (__closure=0x7ffe889a2c20) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:153\n"
    ~"#2  0x00007f26f0884ffb in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}>(void**, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}&&) (args=0x7ffe889a2ed0, fn=...) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:72\n"
    ~"#3  0x00007f26f088456f in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:152\n"
    ~"#4  0x00007f26f08833de in QtPrivate::FunctionPointer<void (QtClipboard::*)(QClipboard::Mode)>::call<QtPrivate::List<QClipboard::Mode>, void>(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:200\n"
    ~"#5  0x00007f26f0881f71 in QtPrivate::QCallableObject<void (QtClipboard::*)(QClipboard::Mode), QtPrivate::List<QClipboard::Mode>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0, ret=0x0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:571\n"
    ~"#6  0x00007f26efdb863f in QtPrivate::QSlotObjectBase::call(QObject*, void**) (this=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:487\n"
    ~"#7  0x00007f26efe5772e in doActivate<false>(QObject*, int, void**) (sender=0x557f8d510fd0, signal_index=3, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4116\n"
    ~"#8  0x00007f26efe4cdef in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=0x557f8d510fd0, m=0x7f26efa47cc0 <QClipboard::staticMetaObject>, local_signal_index=0, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4176\n"
    ~"#9  0x00007f26eede9fcc in QClipboard::changed(QClipboard::Mode) (this=0x557f8d510fd0, _t1=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/Gui_autogen/include/moc_qclipboard.cpp:182\n"
    ~"#10 0x00007f26eede9bc1 in QClipboard::emitChanged(QClipboard::Mode) (this=0x557f8d510fd0, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:558\n"
    ~"#11 0x00007f26eee4ed69 in QPlatformClipboard::emitChanged(QClipboard::Mode) (this=0x557f88019c20, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qplatformclipboard.cpp:89\n"
    ~"#12 0x00007f26ed78809e in QtWaylandClient::QWaylandClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f88019c20, data=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtwayland/src/client/qwaylandclipboard.cpp:89\n"
    ~"#13 0x00007f26eede99de in QClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f8d510fd0, src=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:447\n"
    ~"#14 0x00007f26f087a5b5 in QtClipboard::setContents(com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable> const&, com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboardOwner> const&) (this=0x557f8d50cbb0, xTrans=uno::Reference to (SwTransferable *) 0x557f90440118, xClipboardOwner=uno::Reference to (SwTransferable *) 0x557f90440120) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:137\n"
    ~"#15 0x00007f26fb05bacc in TransferableHelper::CopyToClipboard(com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> const&) const (this=0x557f904400f0, rClipboard=uno::Reference to (QtClipboard *) 0x557f8d50cc10) at .../libreoffice/vcl/source/treelist/transfer.cxx:942\n"
    ~"#16 0x00007f26fb05bc77 in TransferableHelper::CopyToClipboard(vcl::Window*) const (this=0x557f904400f0, pWindow=0x557f8932d1f0) at .../libreoffice/vcl/source/treelist/transfer.cxx:957\n"
    ~"#17 0x00007f26b5130940 in SwTransferable::RemoveDDELinkFormat(vcl::Window&) (this=0x557f904400f0, rWin=...) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:385\n"
    ~"#18 0x00007f26b51440ab in SwTransferDdeLink::DataChanged(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x557f8fb864e0) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:4447\n"
    ~"#19 0x00007f270120fa0e in sfx2::SvLinkSource::NotifyDataChanged() (this=0x557f8fb8bbe0) at .../libreoffice/sfx2/source/appl/linksrc.cxx:291\n"
    ~"#20 0x00007f26b43210ba in SwServerObject::SendDataChanged(SwPaM const&) (this=0x557f8fb8bbe0, rRange=SwPaM = {...}) at .../libreoffice/sw/source/core/doc/swserv.cxx:177\n"
    ~"#21 0x00007f26b43217c2 in SwDataChanged::~SwDataChanged() (this=0x7ffe889a3520, __in_chrg=<optimized out>) at .../libreoffice/sw/source/core/doc/swserv.cxx:308\n"
    ~"#22 0x00007f26b4233c8b in sw::DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4474\n"
    ~"#23 0x00007f26b4233826 in sw::DocumentContentOperationsManager::DeleteRangeImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4419\n"
    ~"#24 0x00007f26b4233681 in sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4391\n"
    ~"#25 0x00007f26b421edb7 in (anonymous namespace)::lcl_DoWithBreaks(sw::DocumentContentOperationsManager&, SwPaM&, SwDeleteFlags, bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager* const, SwPaM&, SwDeleteFlags)) (rDocumentContentOperations=..., rPam=SwPaM = {...}, flags=SwDeleteFlags::Default, pFunc=(bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager * const, SwPaM &, SwDeleteFlags)) 0x7f26b4233632 <sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags)>) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:681\n"
    ~"#26 0x00007f26b42279df in sw::DocumentContentOperationsManager::DeleteAndJoin(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:2367\n"
    ~"#27 0x00007f26b44a71f6 in SwEditShell::DeleteSel(SwPaM&, bool, bool, bool*) (this=0x557f8d51b300, rPam=SwPaM = {...}, isArtificialSelection=false, goLeft=false, pUndo=0x7ffe889a3be6) at .../libreoffice/sw/source/core/edit/eddel.cxx:122\n"
    ~"#28 0x00007f26b44a7671 in SwEditShell::Delete(bool, bool) (this=0x557f8d51b300, isArtificialSelection=false, goLeft=false) at .../libreoffice/sw/source/core/edit/eddel.cxx:164\n"
    ~"#29 0x00007f26b5604933 in SwWrtShell::DelRight(bool) (this=0x557f8d51b300, isReplaceHeuristic=false) at .../libreoffice/sw/source/uibase/wrtsh/delete.cxx:312\n"
    ~"#30 0x00007f26b512fe14 in (anonymous namespace)::SwTrnsfrActionAndUndo::SwTrnsfrActionAndUndo(SwWrtShell*, bool, SwPasteContext*) (this=0x557f9045b020, pS=0x557f8d51b300, bDelSel=true, pContext=0x7ffe889a4220) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:236\n"
    ~"#31 0x00007f26b51377c1 in SwTransferable::PasteData(TransferableDataHelper const&, SwWrtShell&, unsigned char, SotExchangeActionFlags, SotClipboardFormatId, SotExchangeDest, bool, bool, Point const*, signed char, bool, RndStdIds, bool, SwPasteContext*, PasteTableType) (rData=..., rSh=..., nAction=36 '$', nActionFlags=(SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl), nFormat=SotClipboardFormatId::HTML, nDestination=SotExchangeDest::SWDOC_FREE_AREA, bIsPasteFormat=false, bIsDefault=false, pPt=0x0, nDropAction=0 '\\000', bPasteSelection=false, nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, pContext=0x7ffe889a4220, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1768\n"
    ~"#32 0x00007f26b5137333 in SwTransferable::Paste(SwWrtShell&, TransferableDataHelper&, RndStdIds, bool, PasteTableType) (rSh=..., rData=..., nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1687\n"
    ~"#33 0x00007f26b52d29e9 in SwBaseShell::ExecClpbrd(SfxRequest&) (this=0x557f8db64330, rReq=...) at .../libreoffice/sw/source/uibase/shells/basesh.cxx:365\n"
    ~"#34 0x00007f26b52d1681 in SfxStubSwBaseShellExecClpbrd(SfxShell*, SfxRequest&) (pShell=0x557f8db64330, rReq=...) at .../libreoffice/workdir/SdiTarget/sw/sdi/swslots.hxx:2219\n"
    ~"#35 0x00007f27012d14dc in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., bRecord=true) at .../libreoffice/sfx2/source/control/dispatch.cxx:254\n"
    ~"#36 0x00007f27012d4b34 in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., eCallMode=SfxCallMode::RECORD) at .../libreoffice/sfx2/source/control/dispatch.cxx:753\n"
    ~"#37 0x00007f27012c05d4 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) (this=0x557f8d503240, aReq=..., pSlot=0x7f26b6cf5360 <aSwBaseShellSlots_Impl+1440>, pShell=0x557f8db64330) at .../libreoffice/sfx2/source/control/bindings.cxx:1057\n"
    ~"#38 0x00007f270139813d in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) (this=0x557f8db682a0, aURL=..., aArgs=empty uno::Sequence, rListener=empty uno::Reference) at .../libreoffice/sfx2/source/control/unoctitm.cxx:688\n"
    ~"#39 0x00007f2701395dbf in SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x557f8db68200, aURL=..., aArgs=empty uno::Sequence) at .../libreoffice/sfx2/source/control/unoctitm.cxx:250\n"
    ~"#40 0x00007f26fe03d948 in svt::(anonymous namespace)::AsyncAccelExec::impl_ts_asyncCallback(LinkParamNone*) (this=0x557f8fb8e070) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:508\n"
    ~"#41 0x00007f26fe03d869 in svt::(anonymous namespace)::AsyncAccelExec::LinkStubimpl_ts_asyncCallback(void*, LinkParamNone*) (instance=0x557f8fb8e070, data=0x0) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:500\n"
    ~"#42 0x00007f26fab0db3b in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x557f8fb8e110, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#43 0x00007f26fb469f3d in vcl::EventPoster::DoEvent_Impl(void*) (this=0x557f8fb8e108) at .../libreoffice/vcl/source/helper/evntpost.cxx:52\n"
    ~"#44 0x00007f26fb469f05 in vcl::EventPoster::LinkStubDoEvent_Impl(void*, void*) (instance=0x557f8fb8e108, data=0x0) at .../libreoffice/vcl/source/helper/evntpost.cxx:48\n"
    ~"#45 0x00007f26fadc2373 in Link<void*, void>::Call(void*) const (this=0x7f26e80153b8, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#46 0x00007f26fadbf458 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2287\n"
    ~"#47 0x00007f26fadc1385 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x557f897d0e90, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2851\n"
    ~"#48 0x00007f26f08b6bae in SalFrame::CallCallback(SalEvent, void const*) const (this=0x557f8800cf80, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/inc/salframe.hxx:310\n"
    ~"#49 0x00007f26f08d9dbf in QtInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x557f88020780, aEvent=...) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:516\n"
    ~"#50 0x00007f26fb47b97f in operator()() const (__closure=0x7ffe889a50e0) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119\n"
    ~"#51 0x00007f26fb47bc53 in SalUserEventList::DispatchUserEvents(bool) (this=0x557f880207b8, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120\n"
    ~"#52 0x00007f26f08d98a4 in QtInstance::ImplYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:442\n"
    ~"#53 0x00007f26f08d9a4f in QtInstance::DoYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464\n"
    ~"#54 0x00007f26fb5390d0 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390\n"
    ~"#55 0x00007f26fb539e6e in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:474\n"
    ~"#56 0x00007f26fb538dc3 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:368\n"
    ~"#57 0x00007f2704e371b6 in desktop::Desktop::Main() (this=0x7ffe889a5c10) at .../libreoffice/desktop/source/app/app.cxx:1614\n"
    ~"#58 0x00007f26fb558292 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229\n"
    ~"#59 0x00007f26fb5585a7 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261\n"
    ~"#60 0x00007f2704ea4307 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94\n"
    ~"#61 0x0000557f862d19d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51\n"
    ~"#62 0x0000557f862d19ba in main (argc=3, argv=0x7ffe889a5e38) at .../libreoffice/desktop/source/app/main.c:49\n"
    2906^done
    (gdb)

Change-Id: I1f517d441eeb3e77e969062b884d9a425038b22a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163202
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit cb9513c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163179
Reviewed-by: Michael Stahl <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 22, 2024
In `SwTransferable::RemoveDDELinkFormat`, only update the
clipboard content with this `SwTransferable` after removing
the `SotClipboardFormatId::LINK` from the supported formats
if the `SwTransferable` was the clipboard content before
already.

Doing so always would unrelatedly overwrite what was previously
copied from another application to the clipboard for the
tdf#158947 scenario of pasting clipboard content of another
application over a selection when using the Qt-based VCL plugins
on Wayland (s. backtrace below that shows how the clipboard content
was overwritten, frame #17 is the method changed in this
commit).

My assumption why the clipboard content is explicitly overwritten
at all is to make sure that the system clipboard on some platforms
gets notified about the change in supported formats/mime
types after removing one. But that isn't necessary when the
transfer data modified here aren't the current clipboard content
in the first place.

Backtrace for how clipboard content was previously overwritten
for the tdf#158947 scenario with the qt6 VCL plugin on Wayland:

    ~"#0  QtClipboard::handleChanged(QClipboard::Mode) (this=0x557f90457770, aMode=QClipboard::Clipboard) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:156\n"
    ~"#1  0x00007f26f08844ff in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}::operator()() const (__closure=0x7ffe889a2c20) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:153\n"
    ~"#2  0x00007f26f0884ffb in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}>(void**, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}&&) (args=0x7ffe889a2ed0, fn=...) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:72\n"
    ~"#3  0x00007f26f088456f in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard::*)(QClipboard::Mode)>::call(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:152\n"
    ~"#4  0x00007f26f08833de in QtPrivate::FunctionPointer<void (QtClipboard::*)(QClipboard::Mode)>::call<QtPrivate::List<QClipboard::Mode>, void>(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void (QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e <QtClipboard::handleChanged(QClipboard::Mode)>, o=0x557f90457770, arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:200\n"
    ~"#5  0x00007f26f0881f71 in QtPrivate::QCallableObject<void (QtClipboard::*)(QClipboard::Mode), QtPrivate::List<QClipboard::Mode>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0, ret=0x0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:571\n"
    ~"#6  0x00007f26efdb863f in QtPrivate::QSlotObjectBase::call(QObject*, void**) (this=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:487\n"
    ~"#7  0x00007f26efe5772e in doActivate<false>(QObject*, int, void**) (sender=0x557f8d510fd0, signal_index=3, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4116\n"
    ~"#8  0x00007f26efe4cdef in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=0x557f8d510fd0, m=0x7f26efa47cc0 <QClipboard::staticMetaObject>, local_signal_index=0, argv=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:4176\n"
    ~"#9  0x00007f26eede9fcc in QClipboard::changed(QClipboard::Mode) (this=0x557f8d510fd0, _t1=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/Gui_autogen/include/moc_qclipboard.cpp:182\n"
    ~"#10 0x00007f26eede9bc1 in QClipboard::emitChanged(QClipboard::Mode) (this=0x557f8d510fd0, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:558\n"
    ~"#11 0x00007f26eee4ed69 in QPlatformClipboard::emitChanged(QClipboard::Mode) (this=0x557f88019c20, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qplatformclipboard.cpp:89\n"
    ~"#12 0x00007f26ed78809e in QtWaylandClient::QWaylandClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f88019c20, data=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtwayland/src/client/qwaylandclipboard.cpp:89\n"
    ~"#13 0x00007f26eede99de in QClipboard::setMimeData(QMimeData*, QClipboard::Mode) (this=0x557f8d510fd0, src=0x557f8fb87930, mode=QClipboard::Clipboard) at .../qt5/qtbase/src/gui/kernel/qclipboard.cpp:447\n"
    ~"#14 0x00007f26f087a5b5 in QtClipboard::setContents(com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable> const&, com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboardOwner> const&) (this=0x557f8d50cbb0, xTrans=uno::Reference to (SwTransferable *) 0x557f90440118, xClipboardOwner=uno::Reference to (SwTransferable *) 0x557f90440120) at .../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:137\n"
    ~"#15 0x00007f26fb05bacc in TransferableHelper::CopyToClipboard(com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> const&) const (this=0x557f904400f0, rClipboard=uno::Reference to (QtClipboard *) 0x557f8d50cc10) at .../libreoffice/vcl/source/treelist/transfer.cxx:942\n"
    ~"#16 0x00007f26fb05bc77 in TransferableHelper::CopyToClipboard(vcl::Window*) const (this=0x557f904400f0, pWindow=0x557f8932d1f0) at .../libreoffice/vcl/source/treelist/transfer.cxx:957\n"
    ~"#17 0x00007f26b5130940 in SwTransferable::RemoveDDELinkFormat(vcl::Window&) (this=0x557f904400f0, rWin=...) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:385\n"
    ~"#18 0x00007f26b51440ab in SwTransferDdeLink::DataChanged(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x557f8fb864e0) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:4447\n"
    ~"#19 0x00007f270120fa0e in sfx2::SvLinkSource::NotifyDataChanged() (this=0x557f8fb8bbe0) at .../libreoffice/sfx2/source/appl/linksrc.cxx:291\n"
    ~"#20 0x00007f26b43210ba in SwServerObject::SendDataChanged(SwPaM const&) (this=0x557f8fb8bbe0, rRange=SwPaM = {...}) at .../libreoffice/sw/source/core/doc/swserv.cxx:177\n"
    ~"#21 0x00007f26b43217c2 in SwDataChanged::~SwDataChanged() (this=0x7ffe889a3520, __in_chrg=<optimized out>) at .../libreoffice/sw/source/core/doc/swserv.cxx:308\n"
    ~"#22 0x00007f26b4233c8b in sw::DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4474\n"
    ~"#23 0x00007f26b4233826 in sw::DocumentContentOperationsManager::DeleteRangeImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4419\n"
    ~"#24 0x00007f26b4233681 in sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:4391\n"
    ~"#25 0x00007f26b421edb7 in (anonymous namespace)::lcl_DoWithBreaks(sw::DocumentContentOperationsManager&, SwPaM&, SwDeleteFlags, bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager* const, SwPaM&, SwDeleteFlags)) (rDocumentContentOperations=..., rPam=SwPaM = {...}, flags=SwDeleteFlags::Default, pFunc=(bool (sw::DocumentContentOperationsManager::*)(sw::DocumentContentOperationsManager * const, SwPaM &, SwDeleteFlags)) 0x7f26b4233632 <sw::DocumentContentOperationsManager::DeleteAndJoinImpl(SwPaM&, SwDeleteFlags)>) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:681\n"
    ~"#26 0x00007f26b42279df in sw::DocumentContentOperationsManager::DeleteAndJoin(SwPaM&, SwDeleteFlags) (this=0x557f8d2b8000, rPam=SwPaM = {...}, flags=SwDeleteFlags::Default) at .../libreoffice/sw/source/core/doc/DocumentContentOperationsManager.cxx:2367\n"
    ~"#27 0x00007f26b44a71f6 in SwEditShell::DeleteSel(SwPaM&, bool, bool, bool*) (this=0x557f8d51b300, rPam=SwPaM = {...}, isArtificialSelection=false, goLeft=false, pUndo=0x7ffe889a3be6) at .../libreoffice/sw/source/core/edit/eddel.cxx:122\n"
    ~"#28 0x00007f26b44a7671 in SwEditShell::Delete(bool, bool) (this=0x557f8d51b300, isArtificialSelection=false, goLeft=false) at .../libreoffice/sw/source/core/edit/eddel.cxx:164\n"
    ~"#29 0x00007f26b5604933 in SwWrtShell::DelRight(bool) (this=0x557f8d51b300, isReplaceHeuristic=false) at .../libreoffice/sw/source/uibase/wrtsh/delete.cxx:312\n"
    ~"#30 0x00007f26b512fe14 in (anonymous namespace)::SwTrnsfrActionAndUndo::SwTrnsfrActionAndUndo(SwWrtShell*, bool, SwPasteContext*) (this=0x557f9045b020, pS=0x557f8d51b300, bDelSel=true, pContext=0x7ffe889a4220) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:236\n"
    ~"#31 0x00007f26b51377c1 in SwTransferable::PasteData(TransferableDataHelper const&, SwWrtShell&, unsigned char, SotExchangeActionFlags, SotClipboardFormatId, SotExchangeDest, bool, bool, Point const*, signed char, bool, RndStdIds, bool, SwPasteContext*, PasteTableType) (rData=..., rSh=..., nAction=36 '$', nActionFlags=(SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl), nFormat=SotClipboardFormatId::HTML, nDestination=SotExchangeDest::SWDOC_FREE_AREA, bIsPasteFormat=false, bIsDefault=false, pPt=0x0, nDropAction=0 '\\000', bPasteSelection=false, nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, pContext=0x7ffe889a4220, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1768\n"
    ~"#32 0x00007f26b5137333 in SwTransferable::Paste(SwWrtShell&, TransferableDataHelper&, RndStdIds, bool, PasteTableType) (rSh=..., rData=..., nAnchorType=RndStdIds::FLY_AT_PARA, bIgnoreComments=false, ePasteTable=PasteTableType::PASTE_DEFAULT) at .../libreoffice/sw/source/uibase/dochdl/swdtflvr.cxx:1687\n"
    ~"#33 0x00007f26b52d29e9 in SwBaseShell::ExecClpbrd(SfxRequest&) (this=0x557f8db64330, rReq=...) at .../libreoffice/sw/source/uibase/shells/basesh.cxx:365\n"
    ~"#34 0x00007f26b52d1681 in SfxStubSwBaseShellExecClpbrd(SfxShell*, SfxRequest&) (pShell=0x557f8db64330, rReq=...) at .../libreoffice/workdir/SdiTarget/sw/sdi/swslots.hxx:2219\n"
    ~"#35 0x00007f27012d14dc in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., bRecord=true) at .../libreoffice/sfx2/source/control/dispatch.cxx:254\n"
    ~"#36 0x00007f27012d4b34 in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) (this=0x557f8d4f46b0, rShell=..., rSlot=..., rReq=..., eCallMode=SfxCallMode::RECORD) at .../libreoffice/sfx2/source/control/dispatch.cxx:753\n"
    ~"#37 0x00007f27012c05d4 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) (this=0x557f8d503240, aReq=..., pSlot=0x7f26b6cf5360 <aSwBaseShellSlots_Impl+1440>, pShell=0x557f8db64330) at .../libreoffice/sfx2/source/control/bindings.cxx:1057\n"
    ~"#38 0x00007f270139813d in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) (this=0x557f8db682a0, aURL=..., aArgs=empty uno::Sequence, rListener=empty uno::Reference) at .../libreoffice/sfx2/source/control/unoctitm.cxx:688\n"
    ~"#39 0x00007f2701395dbf in SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x557f8db68200, aURL=..., aArgs=empty uno::Sequence) at .../libreoffice/sfx2/source/control/unoctitm.cxx:250\n"
    ~"#40 0x00007f26fe03d948 in svt::(anonymous namespace)::AsyncAccelExec::impl_ts_asyncCallback(LinkParamNone*) (this=0x557f8fb8e070) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:508\n"
    ~"#41 0x00007f26fe03d869 in svt::(anonymous namespace)::AsyncAccelExec::LinkStubimpl_ts_asyncCallback(void*, LinkParamNone*) (instance=0x557f8fb8e070, data=0x0) at .../libreoffice/svtools/source/misc/acceleratorexecute.cxx:500\n"
    ~"#42 0x00007f26fab0db3b in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x557f8fb8e110, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#43 0x00007f26fb469f3d in vcl::EventPoster::DoEvent_Impl(void*) (this=0x557f8fb8e108) at .../libreoffice/vcl/source/helper/evntpost.cxx:52\n"
    ~"#44 0x00007f26fb469f05 in vcl::EventPoster::LinkStubDoEvent_Impl(void*, void*) (instance=0x557f8fb8e108, data=0x0) at .../libreoffice/vcl/source/helper/evntpost.cxx:48\n"
    ~"#45 0x00007f26fadc2373 in Link<void*, void>::Call(void*) const (this=0x7f26e80153b8, data=0x0) at .../libreoffice/include/tools/link.hxx:111\n"
    ~"#46 0x00007f26fadbf458 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2287\n"
    ~"#47 0x00007f26fadc1385 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x557f897d0e90, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/source/window/winproc.cxx:2851\n"
    ~"#48 0x00007f26f08b6bae in SalFrame::CallCallback(SalEvent, void const*) const (this=0x557f8800cf80, nEvent=SalEvent::UserEvent, pEvent=0x7f26e80153b0) at .../libreoffice/vcl/inc/salframe.hxx:310\n"
    ~"#49 0x00007f26f08d9dbf in QtInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x557f88020780, aEvent=...) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:516\n"
    ~"#50 0x00007f26fb47b97f in operator()() const (__closure=0x7ffe889a50e0) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119\n"
    ~"#51 0x00007f26fb47bc53 in SalUserEventList::DispatchUserEvents(bool) (this=0x557f880207b8, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120\n"
    ~"#52 0x00007f26f08d98a4 in QtInstance::ImplYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:442\n"
    ~"#53 0x00007f26f08d9a4f in QtInstance::DoYield(bool, bool) (this=0x557f88020780, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464\n"
    ~"#54 0x00007f26fb5390d0 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390\n"
    ~"#55 0x00007f26fb539e6e in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:474\n"
    ~"#56 0x00007f26fb538dc3 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:368\n"
    ~"#57 0x00007f2704e371b6 in desktop::Desktop::Main() (this=0x7ffe889a5c10) at .../libreoffice/desktop/source/app/app.cxx:1614\n"
    ~"#58 0x00007f26fb558292 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229\n"
    ~"#59 0x00007f26fb5585a7 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261\n"
    ~"#60 0x00007f2704ea4307 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94\n"
    ~"#61 0x0000557f862d19d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51\n"
    ~"#62 0x0000557f862d19ba in main (argc=3, argv=0x7ffe889a5e38) at .../libreoffice/desktop/source/app/main.c:49\n"
    2906^done
    (gdb)

Change-Id: I1f517d441eeb3e77e969062b884d9a425038b22a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163202
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit cb9513c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163179
Reviewed-by: Michael Stahl <[email protected]>
(cherry picked from commit 0750cac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163184
Reviewed-by: Xisco Fauli <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 26, 2024
...as seen during CppunitTest_xmloff_style,

> workdir/UnpackedTarball/freetype/src/truetype/ttgxvar.c:1048:31: runtime error: applying zero offset to null pointer
>  #0 in tt_var_get_item_delta at workdir/UnpackedTarball/freetype/src/truetype/ttgxvar.c:1048:31
>  #1 in tt_hvadvance_adjust at workdir/UnpackedTarball/freetype/src/truetype/ttgxvar.c:1242:13
>  #2 in tt_vadvance_adjust at workdir/UnpackedTarball/freetype/src/truetype/ttgxvar.c:1278:12
>  #3 in tt_face_get_metrics at workdir/UnpackedTarball/freetype/src/sfnt/ttmtx.c:319:11
>  #4 in cff_slot_load at workdir/UnpackedTarball/freetype/src/cff/cffgload.c:660:11
>  #5 in cff_glyph_load at workdir/UnpackedTarball/freetype/src/cff/cffdrivr.c:192:13
>  #6 in FT_Load_Glyph at workdir/UnpackedTarball/freetype/src/base/ftobjs.c:1066:15
>  #7 in _cairo_ft_scaled_glyph_load_glyph at workdir/UnpackedTarball/cairo/src/cairo-ft-font.c:2455:13
>  #8 in _cairo_ft_scaled_glyph_init at workdir/UnpackedTarball/cairo/src/cairo-ft-font.c:2640:11
>  #9 in _cairo_scaled_glyph_lookup at workdir/UnpackedTarball/cairo/src/cairo-scaled-font.c:3035:6
>  #10 in _cairo_scaled_font_glyph_device_extents at workdir/UnpackedTarball/cairo/src/cairo-scaled-font.c:2250:15
>  #11 in _cairo_composite_rectangles_init_for_glyphs at workdir/UnpackedTarball/cairo/src/cairo-composite-rectangles.c:476:14
>  #12 in _cairo_compositor_glyphs at workdir/UnpackedTarball/cairo/src/cairo-compositor.c:280:14
>  #13 in _cairo_image_surface_glyphs at workdir/UnpackedTarball/cairo/src/cairo-image-surface.c:1030:12
>  #14 in _cairo_surface_show_text_glyphs at workdir/UnpackedTarball/cairo/src/cairo-surface.c:2920:15
>  #15 in _cairo_gstate_show_text_glyphs at workdir/UnpackedTarball/cairo/src/cairo-gstate.c:2077:15
>  #16 in _cairo_default_context_glyphs at workdir/UnpackedTarball/cairo/src/cairo-default-context.c:1334:12
>  #17 in cairo_show_glyphs at workdir/UnpackedTarball/cairo/src/cairo.c:3670:14
>  #18 in CairoTextRender::DrawTextLayout(GenericSalLayout const&, SalGraphics const&) at vcl/unx/generic/gdi/cairotextrender.cxx:477:9
>  #19 in SvpSalGraphics::DrawTextLayout(GenericSalLayout const&) at vcl/headless/svptext.cxx:72:23
>  #20 in GenericSalLayout::DrawText(SalGraphics&) const at vcl/source/gdi/CommonSalLayout.cxx:171:18
>  #21 in OutputDevice::ImplDrawTextDirect(SalLayout&, bool) at vcl/source/outdev/text.cxx:312:16
>  #22 in OutputDevice::ImplDrawText(SalLayout&) at vcl/source/outdev/text.cxx:463:9
>  #23 in OutputDevice::DrawTextArray(Point const&, rtl::OUString const&, KernArraySpan, std::span<unsigned char const, 18446744073709551615ul>, int, int, SalLayoutFlags, SalLayoutGlyphs const*) at vcl/source/outdev/text.cxx:701:9
>  #24 in SwFntObj::DrawText(SwDrawTextInfo&) at sw/source/core/txtnode/fntcache.cxx:1490:31
>  #25 in SwSubFont::DrawText_(SwDrawTextInfo&, bool) at sw/source/core/txtnode/swfont.cxx:1144:24
>  #26 in SwFont::DrawText_(SwDrawTextInfo&) at sw/source/core/inc/swfont.hxx:324:29
>  #27 in SwTextPaintInfo::DrawText_(rtl::OUString const&, SwLinePortion const&, o3tl::strong_int<int, Tag_TextFrameIndex>, o3tl::strong_int<int, Tag_TextFrameIndex>, bool, bool, bool, bool) at sw/source/core/text/inftxt.cxx:730:21
>  #28 in SwTextPaintInfo::DrawText(SwLinePortion const&, o3tl::strong_int<int, Tag_TextFrameIndex>, bool) const at sw/source/core/text/inftxt.hxx:783:41
>  #29 in SwTextPortion::Paint(SwTextPaintInfo const&) const at sw/source/core/text/portxt.cxx:603:18
>  #30 in SwTextPainter::DrawTextLine(SwRect const&, SwSaveClip&, bool, std::optional<SwTaggedPDFHelper>&, std::optional<SwTaggedPDFHelper>&, bool) at sw/source/core/text/itrpaint.cxx:433:23
>  #31 in SwTextFrame::PaintSwFrame(OutputDevice&, SwRect const&) const at sw/source/core/text/frmpaint.cxx:787:23
>  #32 in SwLayoutFrame::PaintSwFrame(OutputDevice&, SwRect const&) const at sw/source/core/layout/paintfrm.cxx:3804:21
>  #33 in SwFlyFrame::PaintSwFrame(OutputDevice&, SwRect const&) const at sw/source/core/layout/paintfrm.cxx:4507:20
>  #34 in SwVirtFlyDrawObj::wrap_DoPaintObject(drawinglayer::geometry::ViewInformation2D const&) const at sw/source/core/draw/dflyobj.cxx:541:18
>  #35 in drawinglayer::primitive2d::(anonymous namespace)::SwVirtFlyDrawObjPrimitive::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at sw/source/core/draw/dflyobj.cxx:244:35
>  #36 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #37 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:397:13
>  #38 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:69:21
>  #39 in sdr::contact::ObjectContactOfPageView::DoProcessDisplay(sdr::contact::DisplayInfo&) at svx/source/sdr/contact/objectcontactofpageview.cxx:284:31
>  #40 in sdr::contact::ObjectContactOfPageView::ProcessDisplay(sdr::contact::DisplayInfo&) at svx/source/sdr/contact/objectcontactofpageview.cxx:120:21
>  #41 in SdrPageWindow::RedrawLayer(o3tl::strong_int<short, SdrLayerIDTag> const*, sdr::contact::ViewObjectContactRedirector*, basegfx::B2IRange const*) at svx/source/svdraw/sdrpagewindow.cxx:421:28
>  #42 in SdrPageView::DrawLayer(o3tl::strong_int<short, SdrLayerIDTag>, OutputDevice*, sdr::contact::ViewObjectContactRedirector*, tools::Rectangle const&, basegfx::B2IRange const*) at svx/source/svdraw/svdpagv.cxx:265:27
>  #43 in SwViewShellImp::PaintLayer(o3tl::strong_int<short, SdrLayerIDTag>, SwPageFrame const&, SwRect const&, Color const*, bool, sdr::contact::ViewObjectContactRedirector*) at sw/source/core/view/vdraw.cxx:139:20
>  #44 in SwRootFrame::PaintSwFrame(OutputDevice&, SwRect const&) const at sw/source/core/layout/paintfrm.cxx:3527:33
>  #45 in SwViewShell::PrtOle2(SwDoc*, SwViewOption const*, SwPrintData const&, OutputDevice&, tools::Rectangle const&, bool) at sw/source/core/view/vprint.cxx:592:27
>  #46 in SwDocShell::Draw(OutputDevice*, JobSetup const&, unsigned short, bool) at sw/source/uibase/app/docsh.cxx:881:5
>  #47 in SfxObjectShell::DoDraw_Impl(OutputDevice*, Point const&, Fraction const&, Fraction const&, JobSetup const&, unsigned short, bool) at sfx2/source/doc/objembed.cxx:204:5
>  #48 in SfxObjectShell::DoDraw(OutputDevice*, Point const&, Size const&, JobSetup const&, unsigned short, bool) at sfx2/source/doc/objembed.cxx:151:9
>  #49 in SfxObjectShell::CreatePreview_Impl(bool, VirtualDevice*, GDIMetaFile*) const at sfx2/source/doc/objcont.cxx:198:40
>  #50 in SfxObjectShell::GetPreviewBitmap() const at sfx2/source/doc/objcont.cxx:110:9
>  #51 in SfxObjectShell::WriteThumbnail(bool, com::sun::star::uno::Reference<com::sun::star::io::XStream> const&) at sfx2/source/doc/objstor.cxx:3850:31
>  #52 in SfxObjectShell::GenerateAndStoreThumbnail(bool, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&) at sfx2/source/doc/objstor.cxx:3808:33
>  #53 in SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) at sfx2/source/doc/objstor.cxx:1531:19
>  #54 in SfxObjectShell::PreDoSaveAs_Impl(rtl::OUString const&, rtl::OUString const&, SfxItemSet const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/objstor.cxx:3117:39
>  #55 in SfxObjectShell::CommonSaveAs_Impl(INetURLObject const&, rtl::OUString const&, SfxItemSet&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/objstor.cxx:2907:9
>  #56 in SfxObjectShell::APISaveAs_Impl(std::basic_string_view<char16_t, std::char_traits<char16_t>>, SfxItemSet&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/objserv.cxx:320:19
>  #57 in SfxBaseModel::impl_store(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, bool) at sfx2/source/doc/sfxbasemodel.cxx:3233:42
>  #58 in SfxBaseModel::storeToURL(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1815:13
>  #59 in UnoApiTest::saveWithParams(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at test/source/unoapi_test.cxx:213:16
>  #60 in UnoApiTest::save(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:178:5
>  #61 in testWritingModeBTLR::TestBody() at xmloff/qa/unit/style.cxx:193:9

Change-Id: I54d4d90e203127e018b99c34785602ac3d96e425
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163925
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 28, 2024
The recently added CppunitTest_sc_tiledrendering
CPPUNIT_TEST_NAME=testEditShapeText::TestBody had started to cause

> svx/source/svdraw/sdrpagewindow.cxx:471:56: runtime error: member call on address 0x51d0000c4480 which does not point to an object of type 'SdrMarkView'
> 0x51d0000c4480: note: object is of type 'SdrPaintView'
>  00 00 00 00  30 1f 13 bc ca 7f 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  03 00 00 00
>               ^~~~~~~~~~~~~~~~~~~~~~~
>               vptr for 'SdrPaintView'
>  #0 in SdrPageWindow::InvalidatePageWindow(basegfx::B2DRange const&) at svx/source/svdraw/sdrpagewindow.cxx:471:56
>  #1 in sdr::contact::ObjectContactOfPageView::InvalidatePartOfView(basegfx::B2DRange const&) const at svx/source/sdr/contact/objectcontactofpageview.cxx:357:29
>  #2 in sdr::contact::ViewObjectContact::triggerLazyInvalidate() at svx/source/sdr/contact/viewobjectcontact.cxx:267:28
>  #3 in sdr::contact::ObjectContactOfPageView::Invoke() at svx/source/sdr/contact/objectcontactofpageview.cxx:105:29
>  #4 in sdr::contact::ObjectContactOfPageView::~ObjectContactOfPageView() at svx/source/sdr/contact/objectcontactofpageview.cxx:74:13
>  #5 in sdr::contact::ObjectContactOfPageView::~ObjectContactOfPageView() at svx/source/sdr/contact/objectcontactofpageview.cxx:72:9
>  #6 in SdrPageWindow::ResetObjectContact() at svx/source/svdraw/sdrpagewindow.cxx:520:9
>  #7 in SdrPageWindow::~SdrPageWindow() at svx/source/svdraw/sdrpagewindow.cxx:130:5
>  #8 in std::default_delete<SdrPageWindow>::operator()(SdrPageWindow*) const at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/unique_ptr.h:93:2
>  #9 in std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>::~unique_ptr() at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/unique_ptr.h:398:4
>  #10 in void std::destroy_at<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>>(std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*) at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/stl_construct.h:88:15
>  #11 in void std::_Destroy<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>>(std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*) at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/stl_construct.h:149:7
>  #12 in void std::_Destroy_aux<false>::__destroy<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*>(std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*, std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*) at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/stl_construct.h:163:6
>  #13 in void std::_Destroy<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*>(std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*, std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*) at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/stl_construct.h:195:7
>  #14 in void std::_Destroy<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*, std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>>(std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*, std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>*, std::allocator<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>>&) at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/alloc_traits.h:941:7
>  #15 in std::__cxx1998::vector<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>, std::allocator<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>>>::~vector() at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/stl_vector.h:732:2
>  #16 in std::__debug::vector<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>, std::allocator<std::unique_ptr<SdrPageWindow, std::default_delete<SdrPageWindow>>>>::~vector() at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/debug/vector:245:25
>  #17 in SdrPageView::~SdrPageView() at svx/source/svdraw/svdpagv.cxx:122:1
>  #18 in std::default_delete<SdrPageView>::operator()(SdrPageView*) const at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/unique_ptr.h:93:2
>  #19 in std::__uniq_ptr_impl<SdrPageView, std::default_delete<SdrPageView>>::reset(SdrPageView*) at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/unique_ptr.h:205:4
>  #20 in std::unique_ptr<SdrPageView, std::default_delete<SdrPageView>>::reset(SdrPageView*) at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/unique_ptr.h:503:7
>  #21 in SdrPaintView::ClearPageView() at svx/source/svdraw/svdpntv.cxx:356:20
>  #22 in SdrPaintView::~SdrPaintView() at svx/source/svdraw/svdpntv.cxx:189:5
>  #23 in SdrSnapView::~SdrSnapView() at svx/source/svdraw/svdsnpv.cxx:199:1
>  #24 in SdrMarkView::~SdrMarkView() at svx/source/svdraw/svdmrkv.cxx:197:1
>  #25 in SdrEditView::~SdrEditView() at svx/source/svdraw/svdedtv.cxx:126:1
>  #26 in SdrPolyEditView::~SdrPolyEditView() at svx/source/svdraw/svdpoev.cxx:58:1
>  #27 in SdrGlueEditView::~SdrGlueEditView() at svx/source/svdraw/svdglev.cxx:40:1
>  #28 in SdrObjEditView::~SdrObjEditView() at svx/source/svdraw/svdedxv.cxx:101:1
>  #29 in SdrExchangeView::~SdrExchangeView() at include/svx/svdxcgv.hxx:27:25
>  #30 in SdrDragView::~SdrDragView() at svx/source/svdraw/svddrgv.cxx:69:1
>  #31 in SdrCreateView::~SdrCreateView() at svx/source/svdraw/svdcrtv.cxx:199:1
>  #32 in SdrView::~SdrView() at svx/source/svdraw/svdview.cxx:154:1
>  #33 in E3dView::~E3dView() at svx/source/engine3d/view3d.cxx:1457:1
>  #34 in FmFormView::~FmFormView() at svx/source/form/fmview.cxx:124:1
>  #35 in FmFormView::~FmFormView() at svx/source/form/fmview.cxx:119:1
>  #36 in std::default_delete<FmFormView>::operator()(FmFormView*) const at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/unique_ptr.h:93:2
>  #37 in std::unique_ptr<FmFormView, std::default_delete<FmFormView>>::~unique_ptr() at ~/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/unique_ptr.h:398:4
>  #38 in ScGridWindow::~ScGridWindow() at sc/source/ui/view/gridwin.cxx:450:1
>  #39 in ScGridWindow::~ScGridWindow() at sc/source/ui/view/gridwin.cxx:448:1
>  #40 in ScGridWindow::~ScGridWindow() at sc/source/ui/view/gridwin.cxx:448:1
>  #41 in VclReferenceBase::release() const at include/vcl/vclreferencebase.hxx:43:13
>  #42 in rtl::Reference<vcl::Window>::~Reference() at include/rtl/ref.hxx:131:22
>  #43 in VclPtr<vcl::Window>::~VclPtr() at include/vcl/vclptr.hxx:112:5
>  #44 in ImplSVWinData::~ImplSVWinData() at vcl/source/app/svdata.cxx:531:34
>  #45 in DestroySVWinData(ImplSVWinData*) at vcl/source/app/svdata.cxx:388:5
>  #46 in SfxViewFrame::~SfxViewFrame() at sfx2/source/view/viewfrm.cxx:2012:5
>  #47 in SfxViewFrame::Close() at sfx2/source/view/viewfrm.cxx:1190:5
>  #48 in SfxFrame::DoClose_Impl() at sfx2/source/view/frame.cxx:138:37
>  #49 in SfxBaseController::dispose() at sfx2/source/view/sfxbasecontroller.cxx:928:27
>  #50 in (anonymous namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) at framework/source/services/frame.cxx:1495:33
>  #51 in (anonymous namespace)::XFrameImpl::close(unsigned char) at framework/source/services/frame.cxx:1706:12
>  #52 in SfxFrame::DoClose() at sfx2/source/view/frame.cxx:104:29
>  #53 in SfxViewFrame::Notify(SfxBroadcaster&, SfxHint const&) at sfx2/source/view/viewfrm.cxx:1778:28
>  #54 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:40:24
>  #55 in (anonymous namespace)::SfxModelListener_Impl::notifyClosing(com::sun::star::lang::EventObject const&) at sfx2/source/doc/objxtor.cxx:147:12
>  #56 in SfxBaseModel::close(unsigned char) at sfx2/source/doc/sfxbasemodel.cxx:1516:40
>  #57 in SfxBaseModel::dispose() at sfx2/source/doc/sfxbasemodel.cxx:750:13
>  #58 in ScTiledRenderingTest::tearDown() at sc/qa/unit/tiledrendering/tiledrendering.cxx:140:22

The fix appears to be to just not call back into the in-destruction FmFormView -
... - SdrMarkView - ... - SdrPaintView - ... deep-inheritance object, by not
initiating any further triggerLazyInvalidate from within
~ObjectContactOfPageView.

Change-Id: If5e49e4ebdbbf18d38e89c6b28ff3577224080a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164024
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 28, 2024
`Window::dispose` takes care of disposing its
accessible as well.

However, `VCLXWindow::dispose` was explicitly unsetting
the accessible before disposing its `vcl::Window`, resulting
in it not getting disposed, in turn resulting in a crash on exit
for the tdf#159735 case.

Potentially related:

    commit 5aa60be
    Date:   Wed May 12 11:33:06 2021 +0200

        fix leak in VCLXWindow

        which is a little tricky because dispose() can be called from either
        side (vcl::Window or VCLXWindow)

Before that commit, setting a nullptr accessible happened
in the `VCLXWindow` dtor, which is meant to get called after
the `vcl::Window` got disposed in `VCLXWindow::dispose`.
(In the Linux bibisect repo, the commit before that one is fine
and at that commit, the tdf#159735 comment 5 scenario even
crashes in step 3 already.)

Don't unset the `vcl::Window`'s accessible any more in
`VCLXWindow::dispose`, but do that after disposing it in
`vcl::Window::dispose` instead, which seems to be the
natural place to do that anyway.

Backtrace of crash:

    Thread 1 received signal SIGSEGV, Segmentation fault.
    0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    397                     aIt.next()->disposing(rEvt);
    (gdb) bt
    #0  0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear(std::unique_lock<std::mutex>&, com::sun::star::lang::EventObject const&)
        (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    #1  0x00007fd754ae6014 in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
        (_nClient=28, _rxEventSource=uno::Reference to (accessibility::AccessibleListBox *) 0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:204
    #2  0x00007fd754ae1424 in comphelper::OCommonAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:61
    #3  0x00007fd74e884512 in VCLXAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/toolkit/source/awt/vclxaccessiblecomponent.cxx:376
    #4  0x00007fd6a3d506b7 in accessibility::AccessibleListBox::disposing() (this=0x55bf49c0ad00) at .../libreoffice/accessibility/source/extended/accessiblelistbox.cxx:246
    #5  0x00007fd75453f544 in cppu::WeakComponentImplHelperBase::dispose() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:104
    #6  0x00007fd6a3d45fd5 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::dispose() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:90
    #7  0x00007fd75453f1fe in cppu::WeakComponentImplHelperBase::release() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:79
    #8  0x00007fd6a3d47d85 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:86
    #9  0x00007fd6a3d47ca5 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleExtendedComponent>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #10 0x00007fd6a3d47c85 in cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper, com::sun::star::lang::XServiceInfo>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #11 0x00007fd6a3d45f55 in cppu::ImplInheritanceHelper<VCLXAccessibleComponent, com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleSelection>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/implbase.hxx:171
    #12 0x00007fd74282e13e in com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::~Reference() (this=0x55bf49c0e860) at include/com/sun/star/uno/Reference.hxx:114
    #13 0x00007fd7428524c5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__location=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #14 0x00007fd7428524a5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__pointer=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #15 0x00007fd742852477 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #16 0x00007fd74285243d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #17 0x00007fd742852379 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >&) (__first=0x55bf49c0e860, __last=0x55bf49c0e868)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    #18 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120f8)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #19 0x00007fd74285231d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120e0)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #20 0x00007fd7428522f5 in o3tl::sorted_vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::less<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >, o3tl::find_unique>::~sorted_vector()
        (this=0x55bf4d1120e0) at include/o3tl/sorted_vector.hxx:47
    #21 0x00007fd74284f83d in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #22 0x00007fd74284f869 in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #23 0x00007fd7546453a0 in cppu::OWeakObject::release() (this=0x55bf4d1120b0) at .../libreoffice/cppuhelper/source/weak.cxx:230
    #24 0x00007fd742834415 in cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release() (this=0x55bf4d1120b0) at include/cppuhelper/implbase.hxx:115
    #25 0x00007fd754aec91e in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>::~Reference() (this=0x55bf4896c088) at include/com/sun/star/uno/Reference.hxx:114
    #26 0x00007fd754aec8e5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__location=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #27 0x00007fd754aec8c5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__pointer=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #28 0x00007fd754aec897 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c088, __last=0x55bf4896c090)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #29 0x00007fd754aec85d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #30 0x00007fd754aec799 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >&) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    --Type <RET> for more, q to quit, c to continue without paging--
    #31 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector()
        (this=0x55bf49866bc8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #32 0x00007fd754aec73d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector() (this=0x55bf49866bb0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #33 0x00007fd754aec715 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::impl_t::~impl_t() (this=0x55bf49866bb0) at include/o3tl/cow_wrapper.hxx:176
    #34 0x00007fd754aec6e4 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::release() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:207
    #35 0x00007fd754aec675 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::~cow_wrapper() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:271
    #36 0x00007fd754ae6ae5 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::~OInterfaceContainerHelper4() (this=0x55bf49b28380) at include/comphelper/interfacecontainer4.hxx:126
    #37 0x00007fd754ae7c49 in std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::~pair() (this=0x55bf49b28378)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_pair.h:187
    #38 0x00007fd754ae7c25 in std::destroy_at<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*) (__location=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #39 0x00007fd754ae7b4b in std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::destroy<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> >&, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*)
        (__a=..., __p=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:560
    #40 std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x55bf49b28370) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2011
    #41 0x00007fd754ae7ab5 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2033
    #42 0x00007fd754ae79df in std::_Hashtable<unsigned int, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable.h:2524
    #43 0x00007fd754af6415 in std::__cxx1998::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:798
    #44 0x00007fd754ae778d in std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aa80 <(anonymous namespace)::gaClients>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/unordered_map:234
    #45 0x00007fd754ae6640 in comphelper::AccessibleEventNotifier::shutdown() () at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:268
    #46 0x00007fd74d3c5e41 in DeInitVCL() () at .../libreoffice/vcl/source/app/svmain.cxx:619
    #47 0x00007fd74d3c4031 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:254
    #48 0x00007fd74d3c5f79 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #49 0x00007fd7565a4ba3 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #50 0x000055bf472e7a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #51 0x000055bf472e7a37 in main (argc=3, argv=0x7ffccdc2c9a8) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: I251b2f97184e0492f02eb772e5906847f9249506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164090
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 29, 2024
`Window::dispose` takes care of disposing its
accessible as well.

However, `VCLXWindow::dispose` was explicitly unsetting
the accessible before disposing its `vcl::Window`, resulting
in it not getting disposed, in turn resulting in a crash on exit
for the tdf#159735 case.

Potentially related:

    commit 5aa60be
    Date:   Wed May 12 11:33:06 2021 +0200

        fix leak in VCLXWindow

        which is a little tricky because dispose() can be called from either
        side (vcl::Window or VCLXWindow)

Before that commit, setting a nullptr accessible happened
in the `VCLXWindow` dtor, which is meant to get called after
the `vcl::Window` got disposed in `VCLXWindow::dispose`.
(In the Linux bibisect repo, the commit before that one is fine
and at that commit, the tdf#159735 comment 5 scenario even
crashes in step 3 already.)

Don't unset the `vcl::Window`'s accessible any more in
`VCLXWindow::dispose`, but do that after disposing it in
`vcl::Window::dispose` instead, which seems to be the
natural place to do that anyway.

Backtrace of crash:

    Thread 1 received signal SIGSEGV, Segmentation fault.
    0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    397                     aIt.next()->disposing(rEvt);
    (gdb) bt
    #0  0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear(std::unique_lock<std::mutex>&, com::sun::star::lang::EventObject const&)
        (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    #1  0x00007fd754ae6014 in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
        (_nClient=28, _rxEventSource=uno::Reference to (accessibility::AccessibleListBox *) 0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:204
    #2  0x00007fd754ae1424 in comphelper::OCommonAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:61
    #3  0x00007fd74e884512 in VCLXAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/toolkit/source/awt/vclxaccessiblecomponent.cxx:376
    #4  0x00007fd6a3d506b7 in accessibility::AccessibleListBox::disposing() (this=0x55bf49c0ad00) at .../libreoffice/accessibility/source/extended/accessiblelistbox.cxx:246
    #5  0x00007fd75453f544 in cppu::WeakComponentImplHelperBase::dispose() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:104
    #6  0x00007fd6a3d45fd5 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::dispose() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:90
    #7  0x00007fd75453f1fe in cppu::WeakComponentImplHelperBase::release() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:79
    #8  0x00007fd6a3d47d85 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:86
    #9  0x00007fd6a3d47ca5 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleExtendedComponent>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #10 0x00007fd6a3d47c85 in cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper, com::sun::star::lang::XServiceInfo>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #11 0x00007fd6a3d45f55 in cppu::ImplInheritanceHelper<VCLXAccessibleComponent, com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleSelection>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/implbase.hxx:171
    #12 0x00007fd74282e13e in com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::~Reference() (this=0x55bf49c0e860) at include/com/sun/star/uno/Reference.hxx:114
    #13 0x00007fd7428524c5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__location=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #14 0x00007fd7428524a5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__pointer=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #15 0x00007fd742852477 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #16 0x00007fd74285243d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #17 0x00007fd742852379 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >&) (__first=0x55bf49c0e860, __last=0x55bf49c0e868)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    #18 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120f8)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #19 0x00007fd74285231d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120e0)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #20 0x00007fd7428522f5 in o3tl::sorted_vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::less<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >, o3tl::find_unique>::~sorted_vector()
        (this=0x55bf4d1120e0) at include/o3tl/sorted_vector.hxx:47
    #21 0x00007fd74284f83d in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #22 0x00007fd74284f869 in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #23 0x00007fd7546453a0 in cppu::OWeakObject::release() (this=0x55bf4d1120b0) at .../libreoffice/cppuhelper/source/weak.cxx:230
    #24 0x00007fd742834415 in cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release() (this=0x55bf4d1120b0) at include/cppuhelper/implbase.hxx:115
    #25 0x00007fd754aec91e in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>::~Reference() (this=0x55bf4896c088) at include/com/sun/star/uno/Reference.hxx:114
    #26 0x00007fd754aec8e5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__location=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #27 0x00007fd754aec8c5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__pointer=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #28 0x00007fd754aec897 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c088, __last=0x55bf4896c090)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #29 0x00007fd754aec85d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #30 0x00007fd754aec799 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >&) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    --Type <RET> for more, q to quit, c to continue without paging--
    #31 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector()
        (this=0x55bf49866bc8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #32 0x00007fd754aec73d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector() (this=0x55bf49866bb0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #33 0x00007fd754aec715 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::impl_t::~impl_t() (this=0x55bf49866bb0) at include/o3tl/cow_wrapper.hxx:176
    #34 0x00007fd754aec6e4 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::release() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:207
    #35 0x00007fd754aec675 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::~cow_wrapper() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:271
    #36 0x00007fd754ae6ae5 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::~OInterfaceContainerHelper4() (this=0x55bf49b28380) at include/comphelper/interfacecontainer4.hxx:126
    #37 0x00007fd754ae7c49 in std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::~pair() (this=0x55bf49b28378)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_pair.h:187
    #38 0x00007fd754ae7c25 in std::destroy_at<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*) (__location=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #39 0x00007fd754ae7b4b in std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::destroy<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> >&, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*)
        (__a=..., __p=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:560
    #40 std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x55bf49b28370) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2011
    #41 0x00007fd754ae7ab5 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2033
    #42 0x00007fd754ae79df in std::_Hashtable<unsigned int, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable.h:2524
    #43 0x00007fd754af6415 in std::__cxx1998::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:798
    #44 0x00007fd754ae778d in std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aa80 <(anonymous namespace)::gaClients>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/unordered_map:234
    #45 0x00007fd754ae6640 in comphelper::AccessibleEventNotifier::shutdown() () at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:268
    #46 0x00007fd74d3c5e41 in DeInitVCL() () at .../libreoffice/vcl/source/app/svmain.cxx:619
    #47 0x00007fd74d3c4031 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:254
    #48 0x00007fd74d3c5f79 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #49 0x00007fd7565a4ba3 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #50 0x000055bf472e7a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #51 0x000055bf472e7a37 in main (argc=3, argv=0x7ffccdc2c9a8) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: I251b2f97184e0492f02eb772e5906847f9249506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164090
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit 2ea7cdf9876ce2de61458982247ab6861e1aac2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163988
Reviewed-by: Michael Stahl <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Feb 29, 2024
`Window::dispose` takes care of disposing its
accessible as well.

However, `VCLXWindow::dispose` was explicitly unsetting
the accessible before disposing its `vcl::Window`, resulting
in it not getting disposed, in turn resulting in a crash on exit
for the tdf#159735 case.

Potentially related:

    commit 5aa60be
    Date:   Wed May 12 11:33:06 2021 +0200

        fix leak in VCLXWindow

        which is a little tricky because dispose() can be called from either
        side (vcl::Window or VCLXWindow)

Before that commit, setting a nullptr accessible happened
in the `VCLXWindow` dtor, which is meant to get called after
the `vcl::Window` got disposed in `VCLXWindow::dispose`.
(In the Linux bibisect repo, the commit before that one is fine
and at that commit, the tdf#159735 comment 5 scenario even
crashes in step 3 already.)

Don't unset the `vcl::Window`'s accessible any more in
`VCLXWindow::dispose`, but do that after disposing it in
`vcl::Window::dispose` instead, which seems to be the
natural place to do that anyway.

Backtrace of crash:

    Thread 1 received signal SIGSEGV, Segmentation fault.
    0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    397                     aIt.next()->disposing(rEvt);
    (gdb) bt
    #0  0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear(std::unique_lock<std::mutex>&, com::sun::star::lang::EventObject const&)
        (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    #1  0x00007fd754ae6014 in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
        (_nClient=28, _rxEventSource=uno::Reference to (accessibility::AccessibleListBox *) 0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:204
    #2  0x00007fd754ae1424 in comphelper::OCommonAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:61
    #3  0x00007fd74e884512 in VCLXAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/toolkit/source/awt/vclxaccessiblecomponent.cxx:376
    #4  0x00007fd6a3d506b7 in accessibility::AccessibleListBox::disposing() (this=0x55bf49c0ad00) at .../libreoffice/accessibility/source/extended/accessiblelistbox.cxx:246
    #5  0x00007fd75453f544 in cppu::WeakComponentImplHelperBase::dispose() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:104
    #6  0x00007fd6a3d45fd5 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::dispose() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:90
    #7  0x00007fd75453f1fe in cppu::WeakComponentImplHelperBase::release() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:79
    #8  0x00007fd6a3d47d85 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:86
    #9  0x00007fd6a3d47ca5 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleExtendedComponent>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #10 0x00007fd6a3d47c85 in cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper, com::sun::star::lang::XServiceInfo>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #11 0x00007fd6a3d45f55 in cppu::ImplInheritanceHelper<VCLXAccessibleComponent, com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleSelection>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/implbase.hxx:171
    #12 0x00007fd74282e13e in com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::~Reference() (this=0x55bf49c0e860) at include/com/sun/star/uno/Reference.hxx:114
    #13 0x00007fd7428524c5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__location=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #14 0x00007fd7428524a5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__pointer=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #15 0x00007fd742852477 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #16 0x00007fd74285243d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #17 0x00007fd742852379 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >&) (__first=0x55bf49c0e860, __last=0x55bf49c0e868)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    #18 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120f8)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #19 0x00007fd74285231d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120e0)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #20 0x00007fd7428522f5 in o3tl::sorted_vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::less<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >, o3tl::find_unique>::~sorted_vector()
        (this=0x55bf4d1120e0) at include/o3tl/sorted_vector.hxx:47
    #21 0x00007fd74284f83d in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #22 0x00007fd74284f869 in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #23 0x00007fd7546453a0 in cppu::OWeakObject::release() (this=0x55bf4d1120b0) at .../libreoffice/cppuhelper/source/weak.cxx:230
    #24 0x00007fd742834415 in cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release() (this=0x55bf4d1120b0) at include/cppuhelper/implbase.hxx:115
    #25 0x00007fd754aec91e in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>::~Reference() (this=0x55bf4896c088) at include/com/sun/star/uno/Reference.hxx:114
    #26 0x00007fd754aec8e5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__location=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #27 0x00007fd754aec8c5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__pointer=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #28 0x00007fd754aec897 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c088, __last=0x55bf4896c090)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #29 0x00007fd754aec85d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #30 0x00007fd754aec799 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >&) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    --Type <RET> for more, q to quit, c to continue without paging--
    #31 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector()
        (this=0x55bf49866bc8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #32 0x00007fd754aec73d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector() (this=0x55bf49866bb0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #33 0x00007fd754aec715 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::impl_t::~impl_t() (this=0x55bf49866bb0) at include/o3tl/cow_wrapper.hxx:176
    #34 0x00007fd754aec6e4 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::release() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:207
    #35 0x00007fd754aec675 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::~cow_wrapper() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:271
    #36 0x00007fd754ae6ae5 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::~OInterfaceContainerHelper4() (this=0x55bf49b28380) at include/comphelper/interfacecontainer4.hxx:126
    #37 0x00007fd754ae7c49 in std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::~pair() (this=0x55bf49b28378)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_pair.h:187
    #38 0x00007fd754ae7c25 in std::destroy_at<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*) (__location=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #39 0x00007fd754ae7b4b in std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::destroy<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> >&, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*)
        (__a=..., __p=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:560
    #40 std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x55bf49b28370) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2011
    #41 0x00007fd754ae7ab5 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2033
    #42 0x00007fd754ae79df in std::_Hashtable<unsigned int, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable.h:2524
    #43 0x00007fd754af6415 in std::__cxx1998::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:798
    #44 0x00007fd754ae778d in std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aa80 <(anonymous namespace)::gaClients>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/unordered_map:234
    #45 0x00007fd754ae6640 in comphelper::AccessibleEventNotifier::shutdown() () at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:268
    #46 0x00007fd74d3c5e41 in DeInitVCL() () at .../libreoffice/vcl/source/app/svmain.cxx:619
    #47 0x00007fd74d3c4031 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:254
    #48 0x00007fd74d3c5f79 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #49 0x00007fd7565a4ba3 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #50 0x000055bf472e7a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #51 0x000055bf472e7a37 in main (argc=3, argv=0x7ffccdc2c9a8) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: I251b2f97184e0492f02eb772e5906847f9249506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164090
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit 2ea7cdf9876ce2de61458982247ab6861e1aac2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164113
Reviewed-by: Michael Stahl <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Mar 7, 2024
`Window::dispose` takes care of disposing its
accessible as well.

However, `VCLXWindow::dispose` was explicitly unsetting
the accessible before disposing its `vcl::Window`, resulting
in it not getting disposed, in turn resulting in a crash on exit
for the tdf#159735 case.

Potentially related:

    commit 5aa60be
    Date:   Wed May 12 11:33:06 2021 +0200

        fix leak in VCLXWindow

        which is a little tricky because dispose() can be called from either
        side (vcl::Window or VCLXWindow)

Before that commit, setting a nullptr accessible happened
in the `VCLXWindow` dtor, which is meant to get called after
the `vcl::Window` got disposed in `VCLXWindow::dispose`.
(In the Linux bibisect repo, the commit before that one is fine
and at that commit, the tdf#159735 comment 5 scenario even
crashes in step 3 already.)

Don't unset the `vcl::Window`'s accessible any more in
`VCLXWindow::dispose`, but do that after disposing it in
`vcl::Window::dispose` instead, which seems to be the
natural place to do that anyway.

Backtrace of crash:

    Thread 1 received signal SIGSEGV, Segmentation fault.
    0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    397                     aIt.next()->disposing(rEvt);
    (gdb) bt
    #0  0x00007fd754ae6fe9 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear(std::unique_lock<std::mutex>&, com::sun::star::lang::EventObject const&)
        (this=0x7ffccdc2b5b8, rGuard=..., rEvt=...) at include/comphelper/interfacecontainer4.hxx:397
    #1  0x00007fd754ae6014 in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
        (_nClient=28, _rxEventSource=uno::Reference to (accessibility::AccessibleListBox *) 0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:204
    #2  0x00007fd754ae1424 in comphelper::OCommonAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/comphelper/source/misc/accessiblecomponenthelper.cxx:61
    #3  0x00007fd74e884512 in VCLXAccessibleComponent::disposing() (this=0x55bf49c0ad00) at .../libreoffice/toolkit/source/awt/vclxaccessiblecomponent.cxx:376
    #4  0x00007fd6a3d506b7 in accessibility::AccessibleListBox::disposing() (this=0x55bf49c0ad00) at .../libreoffice/accessibility/source/extended/accessiblelistbox.cxx:246
    #5  0x00007fd75453f544 in cppu::WeakComponentImplHelperBase::dispose() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:104
    #6  0x00007fd6a3d45fd5 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::dispose() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:90
    #7  0x00007fd75453f1fe in cppu::WeakComponentImplHelperBase::release() (this=0x55bf49c0ad00) at .../libreoffice/cppuhelper/source/implbase.cxx:79
    #8  0x00007fd6a3d47d85 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/compbase.hxx:86
    #9  0x00007fd6a3d47ca5 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleExtendedComponent>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #10 0x00007fd6a3d47c85 in cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper, com::sun::star::lang::XServiceInfo>::release() (this=0x55bf49c0ad00) at include/cppuhelper/implbase.hxx:171
    #11 0x00007fd6a3d45f55 in cppu::ImplInheritanceHelper<VCLXAccessibleComponent, com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleSelection>::release() (this=0x55bf49c0ad00)
        at include/cppuhelper/implbase.hxx:171
    #12 0x00007fd74282e13e in com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::~Reference() (this=0x55bf49c0e860) at include/com/sun/star/uno/Reference.hxx:114
    #13 0x00007fd7428524c5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__location=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #14 0x00007fd7428524a5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__pointer=0x55bf49c0e860)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #15 0x00007fd742852477 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #16 0x00007fd74285243d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*) (__first=0x55bf49c0e860, __last=0x55bf49c0e868) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #17 0x00007fd742852379 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, com::sun::star::uno::Reference<com::sun::star::uno::XInterface>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >&) (__first=0x55bf49c0e860, __last=0x55bf49c0e868)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    #18 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120f8)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #19 0x00007fd74285231d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::allocator<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> > >::~vector() (this=0x55bf4d1120e0)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #20 0x00007fd7428522f5 in o3tl::sorted_vector<com::sun::star::uno::Reference<com::sun::star::uno::XInterface>, std::less<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >, o3tl::find_unique>::~sorted_vector()
        (this=0x55bf4d1120e0) at include/o3tl/sorted_vector.hxx:47
    #21 0x00007fd74284f83d in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #22 0x00007fd74284f869 in DocumentFocusListener::~DocumentFocusListener() (this=0x55bf4d1120b0) at vcl/inc/unx/gtk/gtkdata.hxx:221
    #23 0x00007fd7546453a0 in cppu::OWeakObject::release() (this=0x55bf4d1120b0) at .../libreoffice/cppuhelper/source/weak.cxx:230
    #24 0x00007fd742834415 in cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release() (this=0x55bf4d1120b0) at include/cppuhelper/implbase.hxx:115
    #25 0x00007fd754aec91e in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>::~Reference() (this=0x55bf4896c088) at include/com/sun/star/uno/Reference.hxx:114
    #26 0x00007fd754aec8e5 in std::destroy_at<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__location=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #27 0x00007fd754aec8c5 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*)
        (__pointer=0x55bf4896c088) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
    #28 0x00007fd754aec897 in std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c088, __last=0x55bf4896c090)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163
    #29 0x00007fd754aec85d in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*>(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:195
    #30 0x00007fd754aec799 in std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>*, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >&) (__first=0x55bf4896c080, __last=0x55bf4896c090) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948
    --Type <RET> for more, q to quit, c to continue without paging--
    #31 std::__cxx1998::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector()
        (this=0x55bf49866bc8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:732
    #32 0x00007fd754aec73d in std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >::~vector() (this=0x55bf49866bb0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/vector:230
    #33 0x00007fd754aec715 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::impl_t::~impl_t() (this=0x55bf49866bb0) at include/o3tl/cow_wrapper.hxx:176
    #34 0x00007fd754aec6e4 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::release() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:207
    #35 0x00007fd754aec675 in o3tl::cow_wrapper<std::__debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >, o3tl::ThreadSafeRefCountingPolicy>::~cow_wrapper() (this=0x55bf49b28380) at include/o3tl/cow_wrapper.hxx:271
    #36 0x00007fd754ae6ae5 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::~OInterfaceContainerHelper4() (this=0x55bf49b28380) at include/comphelper/interfacecontainer4.hxx:126
    #37 0x00007fd754ae7c49 in std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::~pair() (this=0x55bf49b28378)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_pair.h:187
    #38 0x00007fd754ae7c25 in std::destroy_at<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*) (__location=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
    #39 0x00007fd754ae7b4b in std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::destroy<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >(std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> >&, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >*)
        (__a=..., __p=0x55bf49b28378) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:560
    #40 std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x55bf49b28370) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2011
    #41 0x00007fd754ae7ab5 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, false>*)
        (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>, __n=0x0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2033
    #42 0x00007fd754ae79df in std::_Hashtable<unsigned int, std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > >, std::__detail::_Select1st, std::equal_to<unsigned int>, std::hash<unsigned int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable.h:2524
    #43 0x00007fd754af6415 in std::__cxx1998::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aaa8 <(anonymous namespace)::gaClients+40>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:798
    #44 0x00007fd754ae778d in std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> > > >::clear() (this=0x7fd754d2aa80 <(anonymous namespace)::gaClients>)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/debug/unordered_map:234
    #45 0x00007fd754ae6640 in comphelper::AccessibleEventNotifier::shutdown() () at .../libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:268
    #46 0x00007fd74d3c5e41 in DeInitVCL() () at .../libreoffice/vcl/source/app/svmain.cxx:619
    #47 0x00007fd74d3c4031 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:254
    #48 0x00007fd74d3c5f79 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #49 0x00007fd7565a4ba3 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #50 0x000055bf472e7a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #51 0x000055bf472e7a37 in main (argc=3, argv=0x7ffccdc2c9a8) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: I251b2f97184e0492f02eb772e5906847f9249506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164090
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit 2ea7cdf9876ce2de61458982247ab6861e1aac2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163988
Reviewed-by: Michael Stahl <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Mar 28, 2024
Seems to be timing dependent, does not always happen.

Stack:
 #0 sal::backtrace_get(unsigned int) at sal/osl/unx/backtraceapi.cxx:42 (discriminator 1)
 #1 (anonymous namespace)::printStack(int) at sal/osl/unx/signal.cxx:289
 #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at sal/osl/unx/signal.cxx:330
 #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at sal/osl/unx/signal.cxx:427
 #4 __restore_rt at libc_sigaction.c:?
 #5 std::__uniq_ptr_impl<weld::ComboBox, std::default_delete<weld::ComboBox> >::_M_ptr() const at /usr/include/c++/13/bits/unique_ptr.h:199 (discriminator 1)
 #6 std::unique_ptr<weld::ComboBox, std::default_delete<weld::ComboBox> >::get() const at /usr/include/c++/13/bits/unique_ptr.h:470
 #7 std::unique_ptr<weld::ComboBox, std::default_delete<weld::ComboBox> >::operator->() const at /usr/include/c++/13/bits/unique_ptr.h:464
 #8 SvxTPFilter::GetSelectedAuthor() const at svx/source/dialog/ctredlin.cxx:636 (discriminator 1)
 #9 SwRedlineAcceptDlg::InitAuthors() at sw/source/uibase/misc/redlndlg.cxx:256
 #10 SwRedlineAcceptDlg::Activate() at sw/source/uibase/misc/redlndlg.cxx:492
 #11 SwModelessRedlineAcceptDlg::Activate() at sw/source/uibase/misc/redlndlg.cxx:123
 #12 SfxDialogController::FocusChangeHdl(weld::Container&) at sfx2/source/dialog/basedlgs.cxx:117
 #13 SfxDialogController::LinkStubFocusChangeHdl(void*, weld::Container&) at sfx2/source/dialog/basedlgs.cxx:111
 #14 Link<weld::Container&, void>::Call(weld::Container&) const at include/tools/link.hxx:111
 #15 weld::Container::signal_container_focus_changed() at include/vcl/weld.hxx:368
 #16 SalInstanceContainer::HandleEventListener(VclWindowEvent&) at vcl/source/app/salvtables.cxx:1328
 #17 SalInstanceWidget::EventListener(VclWindowEvent&) at vcl/source/app/salvtables.cxx:824
 #18 SalInstanceWidget::LinkStubEventListener(void*, VclWindowEvent&) at vcl/source/app/salvtables.cxx:821
 #19 Link<VclWindowEvent&, void>::Call(VclWindowEvent&) const at include/tools/link.hxx:111
 #20 vcl::Window::CallEventListeners(VclEventId, void*) at vcl/source/window/event.cxx:257 (discriminator 2)
 #21 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3438
 #22 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3442 (discriminator 1)
 #23 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3442 (discriminator 1)
 #24 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3442 (discriminator 1)
 #25 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3442 (discriminator 1)
 #26 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3442 (discriminator 1)
 #27 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3442 (discriminator 1)
 #28 vcl::Window::ImplCallActivateListeners(vcl::Window*) at vcl/source/window/window.cxx:3442 (discriminator 1)
 #29 vcl::Window::ImplGrabFocus(GetFocusFlags) at vcl/source/window/mouse.cxx:386 (discriminator 15)
 #30 vcl::Window::GrabFocus() at vcl/source/window/window.cxx:2989
 #31 vcl::Window::dispose() at vcl/source/window/window.cxx:433
 #32 Control::dispose() at vcl/source/control/ctrl.cxx:66
 #33 SvTreeListBox::dispose() at vcl/source/treelist/treelistbox.cxx:1341
 #34 SvTabListBox::dispose() at vcl/source/treelist/svtabbx.cxx:244
 #35 SvHeaderTabListBox::dispose() at vcl/source/treelist/svtabbx.cxx:529
 #36 VclReferenceBase::disposeOnce() at vcl/source/outdev/vclreferencebase.cxx:38
 #37 VclPtr<vcl::Window>::disposeAndClear() at include/vcl/vclptr.hxx:209
 #38 VclBuilder::disposeBuilder() at vcl/source/window/builder.cxx:810 (discriminator 2)
 #39 VclBuilder::~VclBuilder() at vcl/source/window/builder.cxx:805
 #40 std::default_delete<VclBuilder>::operator()(VclBuilder*) const at /usr/include/c++/13/bits/unique_ptr.h:99 (discriminator 1)
 #41 std::__uniq_ptr_impl<VclBuilder, std::default_delete<VclBuilder> >::reset(VclBuilder*) at /usr/include/c++/13/bits/unique_ptr.h:212
 #42 std::unique_ptr<VclBuilder, std::default_delete<VclBuilder> >::reset(VclBuilder*) at /usr/include/c++/13/bits/unique_ptr.h:510
 #43 SalInstanceBuilder::~SalInstanceBuilder() at vcl/source/app/salvtables.cxx:7456
 #44 SalInstanceBuilder::~SalInstanceBuilder() at vcl/source/app/salvtables.cxx:7457 (discriminator 1)
 #45 std::default_delete<weld::Builder>::operator()(weld::Builder*) const at /usr/include/c++/13/bits/unique_ptr.h:100
 #46 std::unique_ptr<weld::Builder, std::default_delete<weld::Builder> >::~unique_ptr() at /usr/include/c++/13/bits/unique_ptr.h:405
 #47 SvxTPage::~SvxTPage() at svx/source/dialog/ctredlin.cxx:289
 #48 SvxTPView::~SvxTPView() at svx/source/dialog/ctredlin.cxx:341
 #49 SvxTPView::~SvxTPView() at svx/source/dialog/ctredlin.cxx:341 (discriminator 1)
 #50 std::default_delete<SvxTPView>::operator()(SvxTPView*) const at /usr/include/c++/13/bits/unique_ptr.h:100
 #51 std::__uniq_ptr_impl<SvxTPView, std::default_delete<SvxTPView> >::reset(SvxTPView*) at /usr/include/c++/13/bits/unique_ptr.h:212
 #52 std::unique_ptr<SvxTPView, std::default_delete<SvxTPView> >::reset(SvxTPView*) at /usr/include/c++/13/bits/unique_ptr.h:510
 #53 SvxAcceptChgCtr::~SvxAcceptChgCtr() at svx/source/dialog/ctredlin.cxx:972
 #54 std::default_delete<SvxAcceptChgCtr>::operator()(SvxAcceptChgCtr*) const at /usr/include/c++/13/bits/unique_ptr.h:99 (discriminator 1)
 #55 std::unique_ptr<SvxAcceptChgCtr, std::default_delete<SvxAcceptChgCtr> >::~unique_ptr() at /usr/include/c++/13/bits/unique_ptr.h:405
 #56 SwRedlineAcceptDlg::~SwRedlineAcceptDlg() at sw/source/uibase/misc/redlndlg.cxx:210 (discriminator 3)
 #57 std::default_delete<SwRedlineAcceptDlg>::operator()(SwRedlineAcceptDlg*) const at /usr/include/c++/13/bits/unique_ptr.h:99 (discriminator 1)
 #58 std::unique_ptr<SwRedlineAcceptDlg, std::default_delete<SwRedlineAcceptDlg> >::~unique_ptr() at /usr/include/c++/13/bits/unique_ptr.h:405
 #59 SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg() at sw/source/uibase/misc/redlndlg.cxx:141 (discriminator 1)
 #60 void std::destroy_at<SwModelessRedlineAcceptDlg>(SwModelessRedlineAcceptDlg*) at /usr/include/c++/13/bits/stl_construct.h:89
 #61 void std::_Destroy<SwModelessRedlineAcceptDlg>(SwModelessRedlineAcceptDlg*) at /usr/include/c++/13/bits/stl_construct.h:153
 #62 std::_Sp_counted_ptr_inplace<SwModelessRedlineAcceptDlg, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() at /usr/include/c++/13/bits/alloc_traits.h:674
 #63 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use() at /usr/include/c++/13/bits/shared_ptr_base.h:187
 #64 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold() at /usr/include/c++/13/bits/shared_ptr_base.h:199
 #65 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at /usr/include/c++/13/bits/shared_ptr_base.h:354
 #66 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() at /usr/include/c++/13/bits/shared_ptr_base.h:1072
 #67 std::__shared_ptr<SfxDialogController, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() at /usr/include/c++/13/bits/shared_ptr_base.h:1524
 #68 std::__shared_ptr<SfxDialogController, (__gnu_cxx::_Lock_policy)2>::reset() at /usr/include/c++/13/bits/shared_ptr_base.h:1642
 #69 SfxChildWindow::~SfxChildWindow() at sfx2/source/appl/childwin.cxx:197
 #70 SwChildWinWrapper::~SwChildWinWrapper() at sw/source/uibase/inc/chldwrap.hxx:27
 #71 SwRedlineAcceptChild::~SwRedlineAcceptChild() at sw/source/uibase/inc/redlndlg.hxx:144
 #72 SwRedlineAcceptChild::~SwRedlineAcceptChild() at sw/source/uibase/inc/redlndlg.hxx:144 (discriminator 1)
 #73 SfxChildWindow::Destroy() at sfx2/source/appl/childwin.cxx:177
 #74 SfxWorkWindow::DeleteControllers_Impl() at sfx2/source/appl/workwin.cxx:608
 #75 SfxFrame::DoClose_Impl() at sfx2/source/view/frame.cxx:137
 #76 SfxBaseController::dispose() at sfx2/source/view/sfxbasecontroller.cxx:930
 #77 (anonymous namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) at framework/source/services/frame.cxx:1500
 #78 framework::CloseDispatcher::implts_establishBackingMode() at framework/source/dispatch/closedispatcher.cxx:536
 #79 framework::CloseDispatcher::impl_asyncCallback(LinkParamNone*) at framework/source/dispatch/closedispatcher.cxx:403 (discriminator 1)
 #80 framework::CloseDispatcher::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) at framework/source/dispatch/closedispatcher.cxx:222
 #81 framework::CloseDispatcher::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/dispatch/closedispatcher.cxx:91 (discriminator 2)
 #82 comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) at comphelper/source/misc/dispatchcommand.cxx:63
 #83 comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) at comphelper/source/misc/dispatchcommand.cxx:76
 #84 UITest::executeCommand(rtl::OUString const&) at vcl/source/uitest/uitest.cxx:24 (discriminator 2)
 #85 (anonymous namespace)::UITestUnoObj::executeCommand(rtl::OUString const&) at vcl/source/uitest/uno/uitest_uno.cxx:63 (discriminator 1)
 #86 gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:87
 #87 cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:229
 #88 unoInterfaceProxyDispatch at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:409
 #89 binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const at binaryurp/source/incomingrequest.cxx:239
 #90 binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:79 (discriminator 1)
 #91 request at binaryurp/source/reader.cxx:84
 #92 cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:101
 #93 cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:169
 #94 threadFunc at include/osl/thread.hxx:190
 #95 osl_thread_start_Impl(void*) at sal/osl/unx/thread.cxx:245
 #96 start_thread at ./nptl/./nptl/pthread_create.c:444
 #97 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80

Change-Id: I5f1db80acaf4e9a5ad642baa7061d50af071ad5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165434
Tested-by: Jenkins
Reviewed-by: Noel Grandin <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Apr 11, 2024
Always run `QtGraphics_Controls::getNativeControlRegion`
in the main thread, as it may create a dummy `QLineEdit`
(see the `ControlType::MultilineEditbox` and
`ControlType::Editbox` cases) and creating Qt widgets
is only allowed in the main thread.

Without the following scenario runs into an assert
with a current Qt 6 dev debug build when using the
qt6 VCL plugin:

1) open sample document attachment 193089
   from tdf#160176
2) enable Form Design Toolbar
3) switch to Design mode
4) select label next to "Labelfield2" label
5) right-click, "Control Properties"
6) type anything for the help text and tab
   to the next UI element

Backtrace:

    ASSERT failure in QWidget: "Widgets must be created in the GUI thread.", file /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp, line 956

    Thread 45 "browserlistbox" received signal SIGABRT, Aborted.
    [Switching to Thread 0x7fff8d08d6c0 (LWP 203558)]
    __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007ffff78a81cf in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007ffff785a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007ffff78444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007fffe32f8540 in qAbort() () at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:49
    #5  0x00007fffe330c393 in qt_message_fatal<QString&>(QtMsgType, QMessageLogContext const&, QString&) (context=..., message=...) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:2056
    #6  0x00007fffe3305344 in qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *)
        (msgType=QtFatalMsg, context=..., msg=0x7fffe3981990 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0x7fff8d086178) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:374
    #7  0x00007fffe330740f in QMessageLogger::fatal(char const*, ...) const (this=0x7fff8d0863c0, msg=0x7fffe3981990 "ASSERT failure in %s: \"%s\", file %s, line %d")
        at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:874
    #8  0x00007fffe32f8613 in qt_assert_x(char const*, char const*, char const*, int)
        (where=0x7fffe1becdf3 "QWidget", what=0x7fffe1becdc8 "Widgets must be created in the GUI thread.", file=0x7fffe1becca0 "/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp", line=956)
        at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:114
    #9  0x00007fffe144118c in QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) (this=0x7fff780054d0, parentWidget=0x0, f=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:956
    #10 0x00007fffe1440ca1 in QWidget::QWidget(QWidgetPrivate&, QWidget*, QFlags<Qt::WindowType>) (this=0x7fff8d086d00, dd=..., parent=0x0, f=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:872
    #11 0x00007fffe16a7d22 in QLineEdit::QLineEdit(QString const&, QWidget*) (this=0x7fff8d086d00, contents=..., parent=0x0) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qlineedit.cpp:253
    #12 0x00007fffe16a7c98 in QLineEdit::QLineEdit(QWidget*) (this=0x7fff8d086d00, parent=0x0) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qlineedit.cpp:239
    #13 0x00007fffe404aebc in QtGraphics_Controls::getNativeControlRegion(ControlType, ControlPart, tools::Rectangle const&, ControlState, ImplControlValue const&, rtl::OUString const&, tools::Rectangle&, tools::Rectangle&)
        (this=0x55555cbb13e0, type=ControlType::Editbox, part=ControlPart::Entire, controlRegion=..., controlState=(ControlState::ENABLED | ControlState::ROLLOVER), val=..., nativeBoundingRegion=..., nativeContentRegion=...)
        at vcl/qt6/../qt5/QtGraphics_Controls.cxx:784
    #14 0x00007fffee72945e in SalGraphics::GetNativeControlRegion(ControlType, ControlPart, tools::Rectangle const&, ControlState, ImplControlValue const&, tools::Rectangle&, tools::Rectangle&, OutputDevice const&)
        (this=0x55555eb28920, nType=ControlType::Editbox, nPart=ControlPart::Entire, rControlRegion=..., nState=(ControlState::ENABLED | ControlState::ROLLOVER), aValue=..., rNativeBoundingRegion=..., rNativeContentRegion=..., rOutDev=...)
        at /home/michi/development/git/libreoffice/vcl/source/gdi/salgdilayout.cxx:834
    #15 0x00007fffee3a7195 in OutputDevice::GetNativeControlRegion(ControlType, ControlPart, tools::Rectangle const&, ControlState, ImplControlValue const&, tools::Rectangle&, tools::Rectangle&) const
        (this=0x5555607cd870, nType=ControlType::Editbox, nPart=ControlPart::Entire, rControlRegion=..., nState=(ControlState::ENABLED | ControlState::ROLLOVER), aValue=..., rNativeBoundingRegion=..., rNativeContentRegion=...)
        at /home/michi/development/git/libreoffice/vcl/source/outdev/nativecontrols.cxx:313
    #16 0x00007fffede63b9d in ImplSmallBorderWindowView::DrawWindow(OutputDevice&, Point const*) (this=0x5555607c7c10, rRenderContext=...) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:699
    #17 0x00007fffede69900 in ImplBorderWindow::Paint(OutputDevice&, tools::Rectangle const&) (this=0x5555607c7ca0, rRenderContext=...) at /home/michi/development/git/libreoffice/vcl/source/window/brdwin.cxx:1628
    #18 0x00007fffede3e241 in PaintHelper::DoPaint(vcl::Region const*) (this=0x7fff8d088188, pRegion=0x7fff78006480) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:313
    #19 0x00007fffede3feff in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x5555607c7ca0, pRegion=0x7fff78006480, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:617
    #20 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d0883c8) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #21 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55556002ead0, pRegion=0x7fff78005ec0, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #22 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d088608) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #23 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555edac0e0, pRegion=0x7fff78005dc0, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #24 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d088848) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #25 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555edab480, pRegion=0x7fff78005d80, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #26 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d088a88) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #27 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555edaa900, pRegion=0x7fff78004c40, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #28 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d088cc8) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #29 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555ed29400, pRegion=0x7fff78004c00, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #30 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d088f08) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #31 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555eccc910, pRegion=0x7fff78005d40, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #32 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d089148) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #33 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555eda7a70, pRegion=0x7fff78004ac0, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    --Type <RET> for more, q to quit, c to continue without paging--
    #34 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d089388) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #35 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555eda2210, pRegion=0x7fff78001230, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #36 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d0895c8) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #37 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555ecd5d20, pRegion=0x7fff78002510, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #38 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d089808) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #39 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555ecdae90, pRegion=0x7fff78001ae0, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #40 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d089a48) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #41 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555bb5ddb0, pRegion=0x55555eb4e340, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #42 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d089c88) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #43 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags)
        (this=0x55555ed5c6e0, pRegion=0x7fff78001310, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase)) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #44 0x00007fffede3f791 in PaintHelper::~PaintHelper() (this=0x7fff8d089ec8) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:552
    #45 0x00007fffede3ff86 in vcl::Window::ImplCallPaint(vcl::Region const*, ImplPaintFlags) (this=0x55555eb3aa10, pRegion=0x0, nPaintFlags=(ImplPaintFlags::PaintAllChildren | ImplPaintFlags::PaintChildren | ImplPaintFlags::Erase))
        at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:623
    #46 0x00007fffede41a32 in vcl::Window::PaintImmediately() (this=0x5555607c7ca0) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:1340
    #47 0x00007fffede415a0 in vcl::Window::PaintImmediately() (this=0x5555607c49b0) at /home/michi/development/git/libreoffice/vcl/source/window/paint.cxx:1280
    #48 0x00007fffee17f7ac in Edit::ImplInvalidateOrRepaint() (this=0x5555607c49b0) at /home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:451
    #49 0x00007fffee182a52 in Edit::ImplAlignAndPaint() (this=0x5555607c49b0) at /home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:1170
    #50 0x00007fffee183ef0 in Edit::ImplInsertText(rtl::OUString const&, Selection const*, bool) (this=0x5555607c49b0, rStr="ee", pNewSel=0x7fff8d08a6b8, bIsUserInput=false)
        at /home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:885
    #51 0x00007fffee1841ca in Edit::ImplSetText(rtl::OUString const&, Selection const*) (this=0x5555607c49b0, rText="ee", pNewSelection=0x7fff8d08a6b8) at /home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:918
    #52 0x00007fffee18cfd4 in Edit::SetText(rtl::OUString const&) (this=0x5555607c49b0, rStr="ee") at /home/michi/development/git/libreoffice/vcl/source/control/edit.cxx:2560
    #53 0x00007fffee8d974a in SalInstanceEntry::set_text(rtl::OUString const&) (this=0x5555607c4200, rText="ee") at /home/michi/development/git/libreoffice/vcl/source/app/salvtables.cxx:3383
    #54 0x00007fff7ef6054a in pcr::OEditControl::setValue(com::sun::star::uno::Any const&) (this=0x5555607c7660, _rValue=uno::Any("string": "ee"))
        at /home/michi/development/git/libreoffice/extensions/source/propctrlr/standardcontrol.cxx:200
    #55 0x00007fff7ed96819 in pcr::OBrowserListBox::impl_setControlAsPropertyValue(pcr::ListBoxLine const&, com::sun::star::uno::Any const&) (_rLine=..., _rPropertyValue=uno::Any("string": "ee"))
        at /home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:551
    #56 0x00007fff7ed96485 in pcr::OBrowserListBox::SetPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&, bool) (this=0x55555eda22b0, _rEntryName="HelpText", _rValue=uno::Any("string": "ee"), _bUnknownValue=false)
        at /home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:403
    #57 0x00007fff7ef432e8 in pcr::OPropertyEditor::SetPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&, bool) (this=0x55555ecdb3e0, rEntryName="HelpText", _rValue=uno::Any("string": "ee"), _bUnknownValue=false)
        at /home/michi/development/git/libreoffice/extensions/source/propctrlr/propertyeditor.cxx:277
    #58 0x00007fff7ef01d4f in pcr::OPropertyBrowserController::Commit(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x55555c5f1b40, rName="HelpText", _rValue=uno::Any("string": "ee"))
        at /home/michi/development/git/libreoffice/extensions/source/propctrlr/propcontroller.cxx:1337
    #59 0x00007fff7ed954ae in pcr::OBrowserListBox::valueChanged(com::sun::star::uno::Reference<com::sun::star::inspection::XPropertyControl> const&) (this=0x55555eda22b0, _rxControl=uno::Reference to (pcr::OEditControl *) 0x5555607c76b0)
        at /home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:637
    #60 0x00007fff7ed95268 in pcr::PropertyControlContext_Impl::impl_processEvent_throw(comphelper::AnyEvent const&) (this=0x55555ed29270, _rEvent=...)
        at /home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:291
    #61 0x00007fff7ed950b9 in pcr::PropertyControlContext_Impl::processEvent(comphelper::AnyEvent const&) (this=0x55555ed29270, _rEvent=...) at /home/michi/development/git/libreoffice/extensions/source/propctrlr/browserlistbox.cxx:272
    #62 0x00007ffff6118a2e in comphelper::AsyncEventNotifierBase::execute() (this=0x5555568d6620) at /home/michi/development/git/libreoffice/comphelper/source/misc/asyncnotification.cxx:139
    #63 0x00007ffff6119165 in comphelper::AsyncEventNotifier::execute() (this=0x5555568d6620) at /home/michi/development/git/libreoffice/comphelper/source/misc/asyncnotification.cxx:156
    #64 0x00007ffff7d0f6ec in salhelper::Thread::run() (this=0x5555568d6630) at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
    #65 0x00007ffff7d0ff2e in threadFunc(void*) (param=0x5555568d6640) at include/osl/thread.hxx:189
    #66 0x00007ffff7fa4b2d in osl_thread_start_Impl(void*) (pData=0x55555ecc3e40) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:237
    #67 0x00007ffff78a645c in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
    #68 0x00007ffff7926bbc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Change-Id: I9e0b0d973997e3f4f50a9a31e9692325664fd262
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165995
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Jun 13, 2024
Trying to start LO with the gen/x11 VCL plugin in my KDE Plasma 5
Wayland session triggered this assert:

    soffice.bin: .../libreoffice/sal/rtl/strtmpl.hxx:148: sal_Int32 rtl::str::getLength(const T *) [T = char]: Assertion `pStr' failed.

    Thread 1 "soffice.bin" received signal SIGABRT, Aborted.
    __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007ffff78a6b6f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007ffff78584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007ffff78414ed in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007ffff7841415 in __assert_fail_base
        (fmt=0x7ffff79b7ba8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ffff7ea47e1 "pStr", file=file@entry=0x7ffff7e9fa78 ".../libreoffice/sal/rtl/strtmpl.hxx", line=line@entry=148, function=function@entry=0x7ffff7ea58ba "sal_Int32 rtl::str::getLength(const T *) [T = char]") at ./assert/assert.c:92
    #5  0x00007ffff7851002 in __assert_fail
        (assertion=0x7ffff7ea47e1 "pStr", file=0x7ffff7e9fa78 ".../libreoffice/sal/rtl/strtmpl.hxx", line=148, function=0x7ffff7ea58ba "sal_Int32 rtl::str::getLength(const T *) [T = char]") at ./assert/assert.c:101
    #6  0x00007ffff7f33e2b in rtl::str::getLength<char>(char const*) (pStr=0x0) at sal/rtl/strtmpl.hxx:148
    #7  0x00007ffff7f36ac9 in rtl::str::newFromStr<_rtl_String>(_rtl_String**, std::remove_extent<decltype (_rtl_String::buffer)>::type const*) (ppThis=0x7fffffff7970, pCharStr=0x0) at sal/rtl/strtmpl.hxx:862
    #8  0x00007ffff7f32e9d in rtl_string_newFromStr(rtl_String**, char const*) (ppThis=0x7fffffff7970, pCharStr=0x0) at .../libreoffice/sal/rtl/string.cxx:567
    #9  0x00007fffe46efea7 in rtl::OString::OString<char*>(char* const&, rtl::libreoffice_internal::CharPtrDetector<char*, rtl::libreoffice_internal::Dummy>::Type) (this=0x7fffffff7970, value=@0x7fffffff7978: 0x0)
        at include/rtl/string.hxx:315
    #10 0x00007fffe4711954 in SessionManagerClient::open(SalSession*) (pSession=0x5555567f1bf0) at .../libreoffice/vcl/unx/generic/app/sm.cxx:514
    #11 0x00007fffe4710f94 in X11SalInstance::CreateSalSession() (this=0x5555555ee3d0) at .../libreoffice/vcl/unx/generic/app/sm.cxx:73
    #12 0x00007fffee985cfc in (anonymous namespace)::VCLSession::VCLSession() (this=0x555556903480) at .../libreoffice/vcl/source/app/session.cxx:115
    #13 0x00007fffee985ba9 in com_sun_star_frame_VCLSessionManagerClient_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) ()
        at .../libreoffice/vcl/source/app/session.cxx:411
    #14 0x00007ffff5bed248 in std::__invoke_impl<com::sun::star::uno::XInterface*, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(std::__invoke_other, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
        (__f=@0x5555557170f8: 0x7fffee985b80 <com_sun_star_frame_VCLSessionManagerClient_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>, __args=@0x7fffffff8600: 0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:61
    #15 0x00007ffff5bed1e5 in std::__invoke_r<com::sun::star::uno::XInterface*, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
        (__fn=@0x5555557170f8: 0x7fffee985b80 <com_sun_star_frame_VCLSessionManagerClient_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>, __args=@0x7fffffff8600: 0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:114
    #16 0x00007ffff5bed0dd in std::_Function_handler<com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XInterface* (*)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::_M_invoke(std::_Any_data const&, com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (__functor=..., __args=@0x7fffffff8600: 0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:290
    #17 0x00007ffff5bb8d98 in std::function<com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator()(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const (this=0x5555557170f8, __args=0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:591
    #18 0x00007ffff5ba1599 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
        (this=0x555555717040, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08) at .../libreoffice/cppuhelper/source/servicemanager.cxx:701
    #19 0x00007ffff5ba1461 in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool)
        (this=0x555555717040, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, singletonRequest=false) at .../libreoffice/cppuhelper/source/servicemanager.cxx:670
    #20 0x00007ffff5ba73ad in cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
        (this=0x555555618b60, aServiceSpecifier="com.sun.star.frame.SessionManagerClient", Context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08)
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:1002
    #21 0x00007ffff5ba7d94 in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) ()
        at .../libreoffice/instdir/program/libuno_cppuhelpergcc3.so.3
    #22 0x00007ffff4e6a528 in (anonymous namespace)::SessionListener::initialize(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (this=0x555556935c80, args=uno::Sequence of length 1 = {...})
        at .../libreoffice/framework/source/services/sessionlistener.cxx:254
    #23 0x00007ffff5ba1b79 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (this=0x555555684900, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, arguments=uno::Sequence of length 1 = {...})
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:727
    #24 0x00007ffff5ba19e3 in cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (this=0x555555684900, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, singletonRequest=false, arguments=uno::Sequence of length 1 = {...})
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:689
    #25 0x00007ffff5ba7e35 in cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x555555618b60, ServiceSpecifier="com.sun.star.frame.SessionListener", Arguments=uno::Sequence of length 1 = {...}, Context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08)
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:1014
    #26 0x00007ffff5ba7eec in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) () at .../libreoffice/cppuhelper/source/servicemanager.cxx:1015
    #27 0x00007ffff7b3787f in com::sun::star::frame::SessionListener::createWithOnQuitFlag(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, unsigned char)
        (the_context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, AllowUserInteractionOnQuit=0 '\000') at workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/frame/SessionListener.hpp:48
    #28 0x00007ffff7b2c353 in desktop::Desktop::OpenClients() () at .../libreoffice/desktop/source/app/app.cxx:2094
    #29 0x00007ffff7b2b0a3 in desktop::Desktop::OpenClients_Impl(void*) (this=0x7fffffffd708) at .../libreoffice/desktop/source/app/app.cxx:1952
    #30 0x00007ffff7b2939d in desktop::Desktop::LinkStubOpenClients_Impl(void*, void*) (instance=0x7fffffffd708, data=0x0) at .../libreoffice/desktop/source/app/app.cxx:1936
    --Type <RET> for more, q to quit, c to continue without paging--
    #31 0x00007fffee140c78 in Link<void*, void>::Call(void*) const (this=0x555556f67218, data=0x0) at include/tools/link.hxx:111
    #32 0x00007fffee13c959 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x555556f67210) at .../libreoffice/vcl/source/window/winproc.cxx:2287
    #33 0x00007fffee139310 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x555556dcc250, nEvent=SalEvent::UserEvent, pEvent=0x555556f67210)
        at .../libreoffice/vcl/source/window/winproc.cxx:2851
    #34 0x00007fffeedb53e0 in SalFrame::CallCallback(SalEvent, void const*) const (this=0x5555568f41f0, nEvent=SalEvent::UserEvent, pEvent=0x555556f67210) at vcl/inc/salframe.hxx:312
    #35 0x00007fffeeddff6f in SalGenericDisplay::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x5555567e8960, aEvent=...) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:66
    #36 0x00007fffee8d856d in SalUserEventList::DispatchUserEvents(bool)::$_0::operator()() const (this=0x7fffffffb240) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119
    #37 0x00007fffee8d8414 in SalUserEventList::DispatchUserEvents(bool) (this=0x5555567e8960, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120
    #38 0x00007fffeeddfec5 in SalGenericDisplay::DispatchInternalEvent(bool) (this=0x5555567e8960, bHandleAllCurrentEvent=false) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:51
    #39 0x00007fffe46feb44 in SalX11Display::Yield() (this=0x5555567e8960) at .../libreoffice/vcl/unx/generic/app/saldisp.cxx:1860
    #40 0x00007fffe46f2e97 in DisplayYield(int, void*) (fd=5, data=0x5555567e8960) at .../libreoffice/vcl/unx/generic/app/saldisp.cxx:321
    #41 0x00007fffe46ee64c in (anonymous namespace)::YieldEntry::HandleNextEvent() const (this=0x7fffe47fe078 <yieldTable+200>) at .../libreoffice/vcl/unx/generic/app/saldata.cxx:559
    #42 0x00007fffe46ede15 in SalXLib::Yield(bool, bool) (this=0x5555555ee6e0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/unx/generic/app/saldata.cxx:655
    #43 0x00007fffe470ce8d in X11SalInstance::DoYield(bool, bool) (this=0x5555555ee3d0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/unx/generic/app/salinst.cxx:192
    #44 0x00007fffee9b8e6c in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:384
    #45 0x00007fffee9b877b in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:472
    #46 0x00007fffee9b8512 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:359
    #47 0x00007ffff7b26f10 in desktop::Desktop::Main() (this=0x7fffffffd708) at .../libreoffice/desktop/source/app/app.cxx:1652
    #48 0x00007fffee9dba7e in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229
    #49 0x00007fffee9ddaa9 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #50 0x00007ffff7baaa7c in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:99
    #51 0x0000555555555a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #52 0x0000555555555a37 in main (argc=2, argv=0x7fffffffd918) at .../libreoffice/desktop/source/app/main.c:49

`SmcOpenConnection` in frame 10 above failed, `pClientID` is null:

    (gdb) frame 10
    #10 0x00007fffe4711954 in SessionManagerClient::open (pSession=0x5555567f1bf0) at .../libreoffice/vcl/unx/generic/app/sm.cxx:514
    514                 m_aClientID = OString(pClientID);
    (gdb) p pClientID
    $1 = 0x0
    (gdb) l
    509                                                       aErrBuf );
    510                 if( !m_pSmcConnection )
    511                     SAL_INFO("vcl.sm.debug", "  SmcOpenConnection failed: " << aErrBuf);
    512                 else
    513                     SAL_INFO("vcl.sm.debug", "  SmcOpenConnection succeeded, client ID is " << pClientID );
    514                 m_aClientID = OString(pClientID);
    515                 free( pClientID );
    516                 pClientID = nullptr;
    517             }
    518
    (gdb) p aErrBuf
    $2 = "None of the authentication protocols specified are supported", '\000' <repeats 963 times>

Add a null check.

Quoting from [1]:

> If SmcOpenConnection succeeds, it returns an opaque connection pointer of type SmcConn and
> the client_id_ret argument contains the client ID to be used for this session.

[1] https://www.x.org/releases/X11R7.6/doc/libSM/SMlib.html

Change-Id: I412b5a68e88548718231354b0410c56bc0f0bb90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168771
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Jun 13, 2024
Trying to start LO with the gen/x11 VCL plugin in my KDE Plasma 5
Wayland session triggered this assert:

    soffice.bin: .../libreoffice/sal/rtl/strtmpl.hxx:148: sal_Int32 rtl::str::getLength(const T *) [T = char]: Assertion `pStr' failed.

    Thread 1 "soffice.bin" received signal SIGABRT, Aborted.
    __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007ffff78a6b6f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007ffff78584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007ffff78414ed in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007ffff7841415 in __assert_fail_base
        (fmt=0x7ffff79b7ba8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ffff7ea47e1 "pStr", file=file@entry=0x7ffff7e9fa78 ".../libreoffice/sal/rtl/strtmpl.hxx", line=line@entry=148, function=function@entry=0x7ffff7ea58ba "sal_Int32 rtl::str::getLength(const T *) [T = char]") at ./assert/assert.c:92
    #5  0x00007ffff7851002 in __assert_fail
        (assertion=0x7ffff7ea47e1 "pStr", file=0x7ffff7e9fa78 ".../libreoffice/sal/rtl/strtmpl.hxx", line=148, function=0x7ffff7ea58ba "sal_Int32 rtl::str::getLength(const T *) [T = char]") at ./assert/assert.c:101
    #6  0x00007ffff7f33e2b in rtl::str::getLength<char>(char const*) (pStr=0x0) at sal/rtl/strtmpl.hxx:148
    #7  0x00007ffff7f36ac9 in rtl::str::newFromStr<_rtl_String>(_rtl_String**, std::remove_extent<decltype (_rtl_String::buffer)>::type const*) (ppThis=0x7fffffff7970, pCharStr=0x0) at sal/rtl/strtmpl.hxx:862
    #8  0x00007ffff7f32e9d in rtl_string_newFromStr(rtl_String**, char const*) (ppThis=0x7fffffff7970, pCharStr=0x0) at .../libreoffice/sal/rtl/string.cxx:567
    #9  0x00007fffe46efea7 in rtl::OString::OString<char*>(char* const&, rtl::libreoffice_internal::CharPtrDetector<char*, rtl::libreoffice_internal::Dummy>::Type) (this=0x7fffffff7970, value=@0x7fffffff7978: 0x0)
        at include/rtl/string.hxx:315
    #10 0x00007fffe4711954 in SessionManagerClient::open(SalSession*) (pSession=0x5555567f1bf0) at .../libreoffice/vcl/unx/generic/app/sm.cxx:514
    #11 0x00007fffe4710f94 in X11SalInstance::CreateSalSession() (this=0x5555555ee3d0) at .../libreoffice/vcl/unx/generic/app/sm.cxx:73
    #12 0x00007fffee985cfc in (anonymous namespace)::VCLSession::VCLSession() (this=0x555556903480) at .../libreoffice/vcl/source/app/session.cxx:115
    #13 0x00007fffee985ba9 in com_sun_star_frame_VCLSessionManagerClient_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) ()
        at .../libreoffice/vcl/source/app/session.cxx:411
    #14 0x00007ffff5bed248 in std::__invoke_impl<com::sun::star::uno::XInterface*, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(std::__invoke_other, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
        (__f=@0x5555557170f8: 0x7fffee985b80 <com_sun_star_frame_VCLSessionManagerClient_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>, __args=@0x7fffffff8600: 0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:61
    #15 0x00007ffff5bed1e5 in std::__invoke_r<com::sun::star::uno::XInterface*, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
        (__fn=@0x5555557170f8: 0x7fffee985b80 <com_sun_star_frame_VCLSessionManagerClient_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>, __args=@0x7fffffff8600: 0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:114
    #16 0x00007ffff5bed0dd in std::_Function_handler<com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XInterface* (*)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::_M_invoke(std::_Any_data const&, com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (__functor=..., __args=@0x7fffffff8600: 0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:290
    #17 0x00007ffff5bb8d98 in std::function<com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator()(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const (this=0x5555557170f8, __args=0x5555555e7f08, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:591
    #18 0x00007ffff5ba1599 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
        (this=0x555555717040, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08) at .../libreoffice/cppuhelper/source/servicemanager.cxx:701
    #19 0x00007ffff5ba1461 in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool)
        (this=0x555555717040, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, singletonRequest=false) at .../libreoffice/cppuhelper/source/servicemanager.cxx:670
    #20 0x00007ffff5ba73ad in cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
        (this=0x555555618b60, aServiceSpecifier="com.sun.star.frame.SessionManagerClient", Context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08)
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:1002
    #21 0x00007ffff5ba7d94 in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) ()
        at .../libreoffice/instdir/program/libuno_cppuhelpergcc3.so.3
    #22 0x00007ffff4e6a528 in (anonymous namespace)::SessionListener::initialize(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (this=0x555556935c80, args=uno::Sequence of length 1 = {...})
        at .../libreoffice/framework/source/services/sessionlistener.cxx:254
    #23 0x00007ffff5ba1b79 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (this=0x555555684900, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, arguments=uno::Sequence of length 1 = {...})
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:727
    #24 0x00007ffff5ba19e3 in cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (this=0x555555684900, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, singletonRequest=false, arguments=uno::Sequence of length 1 = {...})
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:689
    #25 0x00007ffff5ba7e35 in cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x555555618b60, ServiceSpecifier="com.sun.star.frame.SessionListener", Arguments=uno::Sequence of length 1 = {...}, Context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08)
        at .../libreoffice/cppuhelper/source/servicemanager.cxx:1014
    #26 0x00007ffff5ba7eec in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) () at .../libreoffice/cppuhelper/source/servicemanager.cxx:1015
    #27 0x00007ffff7b3787f in com::sun::star::frame::SessionListener::createWithOnQuitFlag(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, unsigned char)
        (the_context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x5555555e7f08, AllowUserInteractionOnQuit=0 '\000') at workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/frame/SessionListener.hpp:48
    #28 0x00007ffff7b2c353 in desktop::Desktop::OpenClients() () at .../libreoffice/desktop/source/app/app.cxx:2094
    #29 0x00007ffff7b2b0a3 in desktop::Desktop::OpenClients_Impl(void*) (this=0x7fffffffd708) at .../libreoffice/desktop/source/app/app.cxx:1952
    #30 0x00007ffff7b2939d in desktop::Desktop::LinkStubOpenClients_Impl(void*, void*) (instance=0x7fffffffd708, data=0x0) at .../libreoffice/desktop/source/app/app.cxx:1936
    --Type <RET> for more, q to quit, c to continue without paging--
    #31 0x00007fffee140c78 in Link<void*, void>::Call(void*) const (this=0x555556f67218, data=0x0) at include/tools/link.hxx:111
    #32 0x00007fffee13c959 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x555556f67210) at .../libreoffice/vcl/source/window/winproc.cxx:2287
    #33 0x00007fffee139310 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x555556dcc250, nEvent=SalEvent::UserEvent, pEvent=0x555556f67210)
        at .../libreoffice/vcl/source/window/winproc.cxx:2851
    #34 0x00007fffeedb53e0 in SalFrame::CallCallback(SalEvent, void const*) const (this=0x5555568f41f0, nEvent=SalEvent::UserEvent, pEvent=0x555556f67210) at vcl/inc/salframe.hxx:312
    #35 0x00007fffeeddff6f in SalGenericDisplay::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x5555567e8960, aEvent=...) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:66
    #36 0x00007fffee8d856d in SalUserEventList::DispatchUserEvents(bool)::$_0::operator()() const (this=0x7fffffffb240) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119
    #37 0x00007fffee8d8414 in SalUserEventList::DispatchUserEvents(bool) (this=0x5555567e8960, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120
    #38 0x00007fffeeddfec5 in SalGenericDisplay::DispatchInternalEvent(bool) (this=0x5555567e8960, bHandleAllCurrentEvent=false) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:51
    #39 0x00007fffe46feb44 in SalX11Display::Yield() (this=0x5555567e8960) at .../libreoffice/vcl/unx/generic/app/saldisp.cxx:1860
    #40 0x00007fffe46f2e97 in DisplayYield(int, void*) (fd=5, data=0x5555567e8960) at .../libreoffice/vcl/unx/generic/app/saldisp.cxx:321
    #41 0x00007fffe46ee64c in (anonymous namespace)::YieldEntry::HandleNextEvent() const (this=0x7fffe47fe078 <yieldTable+200>) at .../libreoffice/vcl/unx/generic/app/saldata.cxx:559
    #42 0x00007fffe46ede15 in SalXLib::Yield(bool, bool) (this=0x5555555ee6e0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/unx/generic/app/saldata.cxx:655
    #43 0x00007fffe470ce8d in X11SalInstance::DoYield(bool, bool) (this=0x5555555ee3d0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/unx/generic/app/salinst.cxx:192
    #44 0x00007fffee9b8e6c in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:384
    #45 0x00007fffee9b877b in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:472
    #46 0x00007fffee9b8512 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:359
    #47 0x00007ffff7b26f10 in desktop::Desktop::Main() (this=0x7fffffffd708) at .../libreoffice/desktop/source/app/app.cxx:1652
    #48 0x00007fffee9dba7e in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229
    #49 0x00007fffee9ddaa9 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #50 0x00007ffff7baaa7c in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:99
    #51 0x0000555555555a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #52 0x0000555555555a37 in main (argc=2, argv=0x7fffffffd918) at .../libreoffice/desktop/source/app/main.c:49

`SmcOpenConnection` in frame 10 above failed, `pClientID` is null:

    (gdb) frame 10
    #10 0x00007fffe4711954 in SessionManagerClient::open (pSession=0x5555567f1bf0) at .../libreoffice/vcl/unx/generic/app/sm.cxx:514
    514                 m_aClientID = OString(pClientID);
    (gdb) p pClientID
    $1 = 0x0
    (gdb) l
    509                                                       aErrBuf );
    510                 if( !m_pSmcConnection )
    511                     SAL_INFO("vcl.sm.debug", "  SmcOpenConnection failed: " << aErrBuf);
    512                 else
    513                     SAL_INFO("vcl.sm.debug", "  SmcOpenConnection succeeded, client ID is " << pClientID );
    514                 m_aClientID = OString(pClientID);
    515                 free( pClientID );
    516                 pClientID = nullptr;
    517             }
    518
    (gdb) p aErrBuf
    $2 = "None of the authentication protocols specified are supported", '\000' <repeats 963 times>

Add a null check.

Quoting from [1]:

> If SmcOpenConnection succeeds, it returns an opaque connection pointer of type SmcConn and
> the client_id_ret argument contains the client ID to be used for this session.

[1] https://www.x.org/releases/X11R7.6/doc/libSM/SMlib.html

Change-Id: I412b5a68e88548718231354b0410c56bc0f0bb90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168771
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <[email protected]>
(cherry picked from commit 542e590)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168796
tdf-gerrit pushed a commit that referenced this pull request Jun 19, 2024
...in code newly introduced in 135ce25
"tdf#146487 Don't show generic diagram title when there is an empty title
given", which caused CppunitTest_chart2_export2 to fail with

> /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62: runtime error: load of value 222, which is not a valid value for type 'bool'
>     #0 0x7f95cd9ed87c in oox::drawingml::chart::PlotAreaConverter::isSingleSeriesTitle() const /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62
>     #1 0x7f95cd9e506f in oox::drawingml::chart::ChartSpaceConverter::convertFromModel(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&) /oox/source/drawingml/chart/chartspaceconverter.cxx:189:53
>     #2 0x7f95cd9b6c34 in oox::drawingml::chart::ChartConverter::convertFromModel(oox::core::XmlFilterBase&, oox::drawingml::chart::ChartSpaceModel&, com::sun::star::uno::Reference<com::sun::star::chart2::XChartDocument> const&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&, com::sun::star::awt::Size const&) /oox/source/drawingml/chart/chartconverter.cxx:93:20
>     #3 0x7f95ce548f59 in oox::drawingml::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /oox/source/drawingml/shape.cxx:2245:50
>     #4 0x7f95438150b2 in oox::xls::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /sc/source/filter/oox/drawingfragment.cxx:113:30
>     #5 0x7f95ce5267bb in oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase&, rtl::OUString const&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, bool, bool, basegfx::B2DHomMatrix&, oox::drawingml::FillProperties const&, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:1964:9
>     #6 0x7f95ce4edb54 in oox::drawingml::Shape::addShape(oox::core::XmlFilterBase&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, basegfx::B2DHomMatrix const&, oox::drawingml::FillProperties const&, std::__debug::map<rtl::OUString, std::shared_ptr<oox::drawingml::Shape>, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, std::shared_ptr<oox::drawingml::Shape> > > >*, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:366:41
>     #7 0x7f954381ef79 in oox::xls::DrawingFragment::onEndElement() /sc/source/filter/oox/drawingfragment.cxx:335:30
>     #8 0x7f95cdcaee54 in oox::core::ContextHandler2Helper::implEndElement(int) /oox/source/core/contexthandler2.cxx:125:9
>     #9 0x7f95cdd5c116 in oox::core::FragmentHandler2::endFastElement(int) /oox/source/core/fragmenthandler2.cxx:91:5
>     #10 0x7f95caf68fca in (anonymous namespace)::Entity::endElement() /sax/source/fastparser/fastparser.cxx:514:27
>     #11 0x7f95caf68998 in sax_fastparser::FastSaxParserImpl::callbackEndElement() /sax/source/fastparser/fastparser.cxx:1331:17
>     #12 0x7f95caf58444 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:338:18
>     #13 0x7f960adebeda in xmlParseEndTag2 /workdir/UnpackedTarball/libxml2/parser.c:10090:2
>     #14 0x7f960ad929b5 in xmlParseTryOrFinish /workdir/UnpackedTarball/libxml2/parser.c:11868:14
>     #15 0x7f960ad86334 in xmlParseChunk /workdir/UnpackedTarball/libxml2/parser.c:12151:5
>     #16 0x7f95caf53231 in sax_fastparser::FastSaxParserImpl::parse() /sax/source/fastparser/fastparser.cxx:1085:21
>     #17 0x7f95caf4cd18 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:890:9
>     #18 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #19 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #20 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #21 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #22 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #23 0x7f95441ceaa8 in oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&) /sc/source/filter/oox/workbookhelper.cxx:1046:27
>     #24 0x7f95442797f1 in oox::xls::WorksheetGlobals::finalizeDrawings() /sc/source/filter/oox/worksheethelper.cxx:1373:9
>     #25 0x7f95442789e0 in oox::xls::WorksheetGlobals::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:996:5
>     #26 0x7f954428744d in oox::xls::WorksheetHelper::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:1637:17
>     #27 0x7f95441771de in oox::xls::WorkbookFragment::finalizeImport() /sc/source/filter/oox/workbookfragment.cxx:511:18
>     #28 0x7f95cdd5b3ae in oox::core::FragmentHandler2::endDocument() /oox/source/core/fragmenthandler2.cxx:53:5
>     #29 0x7f95caf4cfc2 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:896:36
>     #30 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #31 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #32 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #33 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #34 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #35 0x7f95435c4daa in oox::xls::ExcelFilter::importDocument() /sc/source/filter/oox/excelfilter.cxx:113:25
>     #36 0x7f95cdcf953b in oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/core/filterbase.cxx:488:49
>     #37 0x7f95435c7733 in oox::xls::ExcelFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sc/source/filter/oox/excelfilter.cxx:176:25
>     #38 0x7f95857c5b40 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sfx2/source/doc/objstor.cxx:2393:34
>     #39 0x7f9585781c6a in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:761:23
>     #40 0x7f95859a9652 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1980:36
>     #41 0x7f95862145e9 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) /sfx2/source/view/frmload.cxx:720:28
>     #42 0x7f95536a9900 in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1176:37
>     #43 0x7f95536a091b in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:412:20
>     #44 0x7f9553698f59 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) /framework/source/loadenv/loadenv.cxx:308:5
>     #45 0x7f95536946e7 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/loadenv/loadenv.cxx:168:14
>     #46 0x7f955376867d in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx:591:16
>     #47 0x7f95537688a6 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx
>     #48 0x7f9569f7cafa in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:71:62
>     #49 0x7f9580718c56 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /test/source/unoapi_test.cxx:126:19
>     #50 0x7f9580717ef8 in UnoApiTest::load(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:108:5
>     #51 0x7f9580719254 in UnoApiTest::loadFromFile(std::basic_string_view<char16_t, std::char_traits<char16_t> >, char const*) /test/source/unoapi_test.cxx:132:5
>     #52 0x7f95d8bf1018 in testTdf123647::TestBody() /chart2/qa/extras/chart2export2.cxx:1242:5

(<https://ci.libreoffice.org//job/lo_ubsan/3048/>)

Change-Id: I870d811e78b8c55b84627ae609f98f623465dd9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162294
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
(cherry picked from commit 3fb9859)
tdf-gerrit pushed a commit that referenced this pull request Jun 26, 2024
Handle the case where `XAccessible::getAccessibleContext`
returns an empty reference, as e.g.
`VCLXWindow::getAccessibleContext` does when already
disposed.

Fixes an assert/crash seen with the gtk4 VCL plugin
when experimenting with missing menu item handling
in Writer's "Tools" -> "Bibliography Database",
expanding the search filter menu, then closing the dialog
and LO altogether.

Backtrace:

    Thread 1 received signal SIGABRT, Aborted.
    __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (rr) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007fe8f96a6b6f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007fe8f96584e2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007fe8f96414ed in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007fe8f9641415 in __assert_fail_base
        (fmt=0x7fe8f97b7ba8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7fe8e5f1ba3a "_pInterface != NULL", file=file@entry=0x7fe8e5f46536 ".../libreoffice/include/com/sun/star/uno/Reference.h", line=line@entry=387, function=function@entry=0x7fe8e5f41e71 "interface_type *com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->() const [interface_type = com::sun::star::accessibility::XAccessibleContext]") at ./assert/assert.c:92
    #5  0x00007fe8f9651002 in __assert_fail
        (assertion=0x7fe8e5f1ba3a "_pInterface != NULL", file=0x7fe8e5f46536 ".../libreoffice/include/com/sun/star/uno/Reference.h", line=387, function=0x7fe8e5f41e71 "interface_type *com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->() const [interface_type = com::sun::star::accessibility::XAccessibleContext]") at ./assert/assert.c:101
    #6  0x00007fe8e6034e42 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->() const (this=0x7ffe3fddc640) at include/com/sun/star/uno/Reference.h:387
    #7  0x00007fe8e6038c14 in map_accessible_role(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> const&) (rAccessible=uno::Reference to (VCLXWindow *) 0x5603d155bba8)
        at .../libreoffice/vcl/unx/gtk4/a11y.cxx:56
    #8  0x00007fe8e6038a16 in lo_accessible_get_property(_GObject*, unsigned int, _GValue*, _GParamSpec*) (object=0x5603e5e9fde0, property_id=2, value=0x7ffe3fddca00, pspec=0x5603bfdc1820)
        at .../libreoffice/vcl/unx/gtk4/a11y.cxx:559
    #9  0x00007fe8f47be345 in g_object_get_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #10 0x00007fe8f47be8b7 in g_object_get () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #11 0x00007fe8e54d81f8 in gtk_accessible_get_accessible_role (self=self@entry=0x5603e5e9fde0) at ../gtk/gtkaccessible.c:296
    #12 0x00007fe8e54d9447 in gtk_accessible_should_present (self=self@entry=0x5603e5e9fde0) at ../gtk/gtkaccessible.c:1304
    #13 0x00007fe8e575dab8 in get_index_in (parent=parent@entry=0x5603e4203030, child=child@entry=0x5603e5ea13a0) at ../gtk/a11y/gtkatspicontext.c:398
    #14 0x00007fe8e5760213 in gtk_at_spi_context_child_change (ctx=0x5603e41f8670, change=GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED, child=0x5603e5ea13a0) at ../gtk/a11y/gtkatspicontext.c:1260
    #15 0x00007fe8e575ed8f in gtk_at_spi_context_state_change
        (ctx=0x5603e5ea15a0, changed_states=GTK_ACCESSIBLE_STATE_CHANGE_HIDDEN, changed_properties=0, changed_relations=<optimized out>, states=0x5603e5ea1770, properties=0x5603e5ea16b0, relations=0x5603e5ea1710)
        at ../gtk/a11y/gtkatspicontext.c:979
    #16 0x00007fe8e54e2bdf in gtk_at_context_update (self=0x5603e5ea15a0) at ../gtk/gtkatcontext.c:831
    #17 0x00007fe8e54d839a in gtk_accessible_update_state (self=self@entry=0x5603e5ea13a0, first_state=first_state@entry=GTK_ACCESSIBLE_STATE_HIDDEN) at ../gtk/gtkaccessible.c:364
    #18 0x00007fe8e5684d4b in gtk_widget_unmap (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2895
    #19 gtk_widget_unmap (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2879
    #20 0x00007fe8e5684e25 in gtk_widget_real_hide (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2811
    #21 0x00007fe8f47b4939 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #22 0x00007fe8f47ca33f in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #23 0x00007fe8f47cff06 in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #24 0x00007fe8f47cffc3 in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #25 0x00007fe8e56872cd in gtk_widget_hide (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2787
    #26 0x00007fe8e61de10e in GtkSalObjectWidgetClip::Show(bool) (this=0x5603dafec8f0, bVisible=false) at vcl/unx/gtk4/../gtk3/gtkobject.cxx:534
    #27 0x00007fe8efc96b3d in vcl::Window::ImplSysObjClip(vcl::Region const*) (this=0x5603e5ebb940, pOldRegion=0x0) at .../libreoffice/vcl/source/window/clipping.cxx:352
    #28 0x00007fe8efc96fa0 in vcl::Window::ImplSetClipFlagChildren(bool) (this=0x5603e5ebb940, bSysObjOnlySmaller=false) at .../libreoffice/vcl/source/window/clipping.cxx:424
    #29 0x00007fe8efc97227 in vcl::Window::ImplSetClipFlag(bool) (this=0x5603e5ebb940, bSysObjOnlySmaller=false) at .../libreoffice/vcl/source/window/clipping.cxx:466
    #30 0x00007fe8eff2307b in vcl::Window::Show(bool, ShowFlags) (this=0x5603e5ebb940, bVisible=false, nFlags=ShowFlags::NONE) at .../libreoffice/vcl/source/window/window.cxx:2238
    #31 0x00007fe8efc6a189 in vcl::Window::Hide() (this=0x5603e5ebb940) at include/vcl/window.hxx:881
    #32 0x00007fe8efeac189 in SystemChildWindow::dispose() (this=0x5603e5ebb940) at .../libreoffice/vcl/source/window/syschild.cxx:121
    #33 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e5ebb950) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
    #34 0x00007fe8e61ad349 in VclPtr<SystemChildWindow>::disposeAndClear() (this=0x5603e5ea49f0) at include/vcl/vclptr.hxx:207
    #35 0x00007fe8e60a30ca in (anonymous namespace)::GtkInstanceBuilder::~GtkInstanceBuilder() (this=0x5603e5ea4900) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:24349
    #36 0x00007fe8e60a3169 in (anonymous namespace)::GtkInstanceBuilder::~GtkInstanceBuilder() (this=0x5603e5ea4900) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:24342
    #37 0x00007fe8efe748cf in std::default_delete<weld::Builder>::operator()(weld::Builder*) const (this=0x5603e41d6730, __ptr=0x5603e5ea4900) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99
    #38 0x00007fe8efe747fc in std::__uniq_ptr_impl<weld::Builder, std::default_delete<weld::Builder> >::reset(weld::Builder*) (this=0x5603e41d6730, __p=0x0)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:211
    #39 0x00007fe8efff1ffd in std::unique_ptr<weld::Builder, std::default_delete<weld::Builder> >::reset(weld::Builder*) (this=0x5603e41d6730, __p=0x0)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:509
    #40 0x00007fe8efff16b3 in InterimItemWindow::dispose() (this=0x5603e41d6660) at .../libreoffice/vcl/source/control/InterimItemWindow.cxx:49
    #41 0x00007fe8a6f57e51 in EditControl::dispose() (this=0x5603e41d6660) at .../libreoffice/extensions/source/bibliography/toolbar.cxx:209
    #42 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e41d67b8) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
    #43 0x00007fe8a6f5d5f6 in VclPtr<EditControl>::disposeAndClear() (this=0x5603e5e8e9f0) at include/vcl/vclptr.hxx:207
    #44 0x00007fe8a6f5a13c in BibToolBar::dispose() (this=0x5603e5e8e580) at .../libreoffice/extensions/source/bibliography/toolbar.cxx:272
    #45 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e5e8ea68) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
    #46 0x00007fe8a6edbf09 in VclPtr<BibToolBar>::disposeAndClear() (this=0x5603e06c1578) at include/vcl/vclptr.hxx:207
    #47 0x00007fe8a6edab2e in bib::BibBeamer::dispose() (this=0x5603e06c1340) at .../libreoffice/extensions/source/bibliography/bibbeam.cxx:205
    #48 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e06c1588) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
    #49 0x00007fe8a6ef2b49 in VclPtr<vcl::Window>::disposeAndClear() (this=0x7ffe3fdddcb0) at include/vcl/vclptr.hxx:207
    #50 0x00007fe8a6ef173a in BibWindowContainer::dispose() (this=0x5603e70e5ed0) at .../libreoffice/extensions/source/bibliography/bibcont.cxx:81
    #51 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603e70e5ef8) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
    #52 0x00007fe8a6ef2b49 in VclPtr<vcl::Window>::disposeAndClear() (this=0x7ffe3fdddd90) at include/vcl/vclptr.hxx:207
    #53 0x00007fe8a6ef2043 in BibBookContainer::dispose() (this=0x5603de460610) at .../libreoffice/extensions/source/bibliography/bibcont.cxx:126
    #54 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce() (this=0x5603de460878) at .../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
    #55 0x00007fe8f1d624a9 in VclPtr<vcl::Window>::disposeAndClear() (this=0x7ffe3fddded8) at include/vcl/vclptr.hxx:207
    #56 0x00007fe8f1d52fe4 in VCLXWindow::dispose() (this=0x5603d155bb40) at .../libreoffice/toolkit/source/awt/vclxwindow.cxx:926
    #57 0x00007fe8f6c28644 in (anonymous namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&)
        (this=0x5603e4174370, xComponentWindow=empty uno::Reference, xController=empty uno::Reference) at .../libreoffice/framework/source/services/frame.cxx:1525
    #58 0x00007fe8f6c2abc8 in (anonymous namespace)::XFrameImpl::close(unsigned char) (this=0x5603e4174370, bDeliverOwnership=0 '\000') at .../libreoffice/framework/source/services/frame.cxx:1707
    #59 0x00007fe8f6a3a23a in framework::pattern::frame::closeIt(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (xResource=uno::Reference to ((anonymous namespace)::XFrameImpl *) 0x5603e41743e0)
        at framework/source/inc/pattern/frame.hxx:57
    #60 0x00007fe8f6a38445 in framework::CloseDispatcher::implts_closeFrame() (this=0x5603e93410a0) at .../libreoffice/framework/source/dispatch/closedispatcher.cxx:500
    #61 0x00007fe8f6a37ab1 in framework::CloseDispatcher::impl_asyncCallback(LinkParamNone*) (this=0x5603e93410a0) at .../libreoffice/framework/source/dispatch/closedispatcher.cxx:379
    #62 0x00007fe8f6a35fed in framework::CloseDispatcher::LinkStubimpl_asyncCallback(void*, LinkParamNone*) (instance=0x5603e93410a0, data=0x0) at .../libreoffice/framework/source/dispatch/closedispatcher.cxx:246
    #63 0x00007fe8efc40828 in Link<LinkParamNone*, void>::Call(LinkParamNone*) const (this=0x5603eb162878, data=0x0) at include/tools/link.hxx:111
    #64 0x00007fe8f06cff25 in vcl::EventPoster::DoEvent_Impl(void*) (this=0x5603eb162870) at .../libreoffice/vcl/source/helper/evntpost.cxx:52
    #65 0x00007fe8f06cfedd in vcl::EventPoster::LinkStubDoEvent_Impl(void*, void*) (instance=0x5603eb162870, data=0x0) at .../libreoffice/vcl/source/helper/evntpost.cxx:48
    #66 0x00007fe8eff4ca78 in Link<void*, void>::Call(void*) const (this=0x5603dfaf31a8, data=0x0) at include/tools/link.hxx:111
    #67 0x00007fe8eff48759 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x5603dfaf31a0) at .../libreoffice/vcl/source/window/winproc.cxx:2287
    #68 0x00007fe8eff45110 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x5603c9d5cf10, nEvent=SalEvent::UserEvent, pEvent=0x5603dfaf31a0)
        at .../libreoffice/vcl/source/window/winproc.cxx:2851
    #69 0x00007fe8f0bd5ba0 in SalFrame::CallCallback(SalEvent, void const*) const (this=0x5603cb949f00, nEvent=SalEvent::UserEvent, pEvent=0x5603dfaf31a0) at vcl/inc/salframe.hxx:312
    #70 0x00007fe8f0c0072f in SalGenericDisplay::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x5603bec36aa0, aEvent=...) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:66
    #71 0x00007fe8f06e433d in SalUserEventList::DispatchUserEvents(bool)::$_0::operator()() const (this=0x7ffe3fddefd0) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119
    #72 0x00007fe8f06e41e4 in SalUserEventList::DispatchUserEvents(bool) (this=0x5603bec36aa0, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/source/app/salusereventlist.cxx:120
    #73 0x00007fe8f0c00685 in SalGenericDisplay::DispatchInternalEvent(bool) (this=0x5603bec36aa0, bHandleAllCurrentEvent=false) at .../libreoffice/vcl/unx/generic/app/gendisp.cxx:51
    #74 0x00007fe8e607b706 in call_userEventFn(void*) (data=0x5603beaa55d0) at vcl/unx/gtk4/../gtk3/gtkdata.cxx:824
    #75 0x00007fe8ead1ce3f in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #76 0x00007fe8ead1eec7 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #77 0x00007fe8ead1f4e0 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #78 0x00007fe8e607a2bf in GtkSalData::Yield(bool, bool) (this=0x5603beaa55d0, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkdata.cxx:405
    #79 0x00007fe8e6080123 in GtkInstance::DoYield(bool, bool) (this=0x5603beaa5480, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:429
    #80 0x00007fe8f07c4d5c in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:384
    #81 0x00007fe8f07c466b in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:472
    #82 0x00007fe8f07c4402 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:359
    #83 0x00007fe8f9926be0 in desktop::Desktop::Main() (this=0x7ffe3fde1018) at .../libreoffice/desktop/source/app/app.cxx:1652
    #84 0x00007fe8f07e796e in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229
    #85 0x00007fe8f07e9999 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #86 0x00007fe8f99a9b2c in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:99
    #87 0x00005603bca36a5d in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #88 0x00005603bca36a37 in main (argc=2, argv=0x7ffe3fde1228) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: Ia3f19d700de66c72f2896595a0e387bd3c42d7ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169451
Reviewed-by: Michael Weghorn <[email protected]>
Tested-by: Jenkins
tdf-gerrit pushed a commit that referenced this pull request Aug 30, 2024
Besides the obvious cases handled in previous commit

    Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
    Author: Michael Weghorn <[email protected]>
    Date:   Fri Aug 30 10:12:21 2024 +0200

        tdf#162696 qt weld: Do GUI things in main thread

, the destruction of `QtInstanceDialog::m_pDialog` (that
previously implicitly happened due to it being a
`std::unique_ptr`) also needs to happen in the main
thread.

Otherwise, it triggers this assert with a debug Qt build
for the tdf#162696 of installing an extension via drag'n'drop
into the start center:

    ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread QThread(0x7f4b14003390). Receiver 'QDialog(0x562e6ba77450)' was created in thread QThread(0x562e69709f60, name = "Qt mainThread")", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 551
    terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

    Fatal exception: Signal 6
    Stack:
    #0 sal::backtrace_get(unsigned int) at /home/michi/development/git/libreoffice/sal/osl/unx/backtraceapi.cxx:42
    #1 (anonymous namespace)::printStack(int) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:289
    #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:330
    #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:427
    #4 /lib/x86_64-linux-gnu/libc.so.6(+0x3f590) [0x7f4be7455590]
    #5 __pthread_kill_implementation at ./nptl/pthread_kill.c:44 (discriminator 1)
    #6 raise at ./signal/../sysdeps/posix/raise.c:27
    #7 abort at ./stdlib/abort.c:81
    #8 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xa1a3d) [0x7f4be70a1a3d]
    #9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7f4be70b306a]
    #10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
    #11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7f4bd2eed562]
    #12 QMessageLogger::fatal() const at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:901
    #13 qt_assert_x(char const*, char const*, char const*, int) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:0
    #14 QCoreApplicationPrivate::checkReceiverThread(QObject*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:0
    #15 QApplication::notify(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2583
    #16 QCoreApplication::notifyInternal2(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1170
    #17 QCoreApplication::sendEvent(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1614
    #18 QWidgetPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8415
    #19 QDialogPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:832
    #20 QMessageBoxPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:1676
    #21 QDialog::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:750
    #22 QWidget::hide() at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8176
    #23 QDialog::~QDialog() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:390
    #24 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:879
    #25 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:878
    #26 std::default_delete<QDialog>::operator()(QDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
    #27 std::unique_ptr<QDialog, std::default_delete<QDialog>>::~unique_ptr() at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:398
    #28 QtInstanceDialog::~QtInstanceDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceDialog.hxx:14
    #29 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
    #30 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
    #31 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
    #32 std::default_delete<weld::MessageDialog>::operator()(weld::MessageDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
    #33 std::__uniq_ptr_impl<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:206
    #34 std::unique_ptr<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:504
    #35 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:379
    #36 dp_gui::(anonymous namespace)::ProgressCmdEnv::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:477
    #37 dp_misc::interactContinuation(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, bool*, bool*) at /home/michi/development/git/libreoffice/desktop/source/deployment/misc/dp_interact.cxx:114
    #38 dp_manager::ExtensionManager::checkInstall(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:1315
    #39 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
    #40 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:655
    #41 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:0
    #42 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
    #43 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
    #44 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
    #45 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
    #46 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
    #47 start_thread at ./nptl/pthread_create.c:447
    #48 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80

Change-Id: Idb5b20bde8c306ed14efd5467887d55fdf470202
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172643
Reviewed-by: Michael Weghorn <[email protected]>
Tested-by: Jenkins
tdf-gerrit pushed a commit that referenced this pull request Aug 31, 2024
Besides the obvious cases handled in previous commit

    Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
    Author: Michael Weghorn <[email protected]>
    Date:   Fri Aug 30 10:12:21 2024 +0200

        tdf#162696 qt weld: Do GUI things in main thread

, the destruction of `QtInstanceDialog::m_pDialog` (that
previously implicitly happened due to it being a
`std::unique_ptr`) also needs to happen in the main
thread.

Otherwise, it triggers this assert with a debug Qt build
for the tdf#162696 of installing an extension via drag'n'drop
into the start center:

    ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread QThread(0x7f4b14003390). Receiver 'QDialog(0x562e6ba77450)' was created in thread QThread(0x562e69709f60, name = "Qt mainThread")", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 551
    terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

    Fatal exception: Signal 6
    Stack:
    #0 sal::backtrace_get(unsigned int) at /home/michi/development/git/libreoffice/sal/osl/unx/backtraceapi.cxx:42
    #1 (anonymous namespace)::printStack(int) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:289
    #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:330
    #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:427
    #4 /lib/x86_64-linux-gnu/libc.so.6(+0x3f590) [0x7f4be7455590]
    #5 __pthread_kill_implementation at ./nptl/pthread_kill.c:44 (discriminator 1)
    #6 raise at ./signal/../sysdeps/posix/raise.c:27
    #7 abort at ./stdlib/abort.c:81
    #8 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xa1a3d) [0x7f4be70a1a3d]
    #9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7f4be70b306a]
    #10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
    #11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7f4bd2eed562]
    #12 QMessageLogger::fatal() const at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:901
    #13 qt_assert_x(char const*, char const*, char const*, int) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:0
    #14 QCoreApplicationPrivate::checkReceiverThread(QObject*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:0
    #15 QApplication::notify(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2583
    #16 QCoreApplication::notifyInternal2(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1170
    #17 QCoreApplication::sendEvent(QObject*, QEvent*) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1614
    #18 QWidgetPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8415
    #19 QDialogPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:832
    #20 QMessageBoxPrivate::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:1676
    #21 QDialog::setVisible(bool) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:750
    #22 QWidget::hide() at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:8176
    #23 QDialog::~QDialog() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:390
    #24 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:879
    #25 QMessageBox::~QMessageBox() at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:878
    #26 std::default_delete<QDialog>::operator()(QDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
    #27 std::unique_ptr<QDialog, std::default_delete<QDialog>>::~unique_ptr() at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:398
    #28 QtInstanceDialog::~QtInstanceDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceDialog.hxx:14
    #29 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
    #30 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
    #31 QtInstanceMessageDialog::~QtInstanceMessageDialog() at /home/michi/development/git/libreoffice/vcl/inc/qt6/../qt5/QtInstanceMessageDialog.hxx:16
    #32 std::default_delete<weld::MessageDialog>::operator()(weld::MessageDialog*) const at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:94
    #33 std::__uniq_ptr_impl<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:206
    #34 std::unique_ptr<weld::MessageDialog, std::default_delete<weld::MessageDialog>>::reset(weld::MessageDialog*) at /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/unique_ptr.h:504
    #35 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:379
    #36 dp_gui::(anonymous namespace)::ProgressCmdEnv::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:477
    #37 dp_misc::interactContinuation(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, bool*, bool*) at /home/michi/development/git/libreoffice/desktop/source/deployment/misc/dp_interact.cxx:114
    #38 dp_manager::ExtensionManager::checkInstall(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:1315
    #39 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
    #40 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:655
    #41 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:0
    #42 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
    #43 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
    #44 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
    #45 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
    #46 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
    #47 start_thread at ./nptl/pthread_create.c:447
    #48 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80

Change-Id: Idb5b20bde8c306ed14efd5467887d55fdf470202
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172643
Reviewed-by: Michael Weghorn <[email protected]>
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172653
Reviewed-by: Adolfo Jayme Barrientos <[email protected]>
tdf-gerrit pushed a commit that referenced this pull request Sep 19, 2024
...in code newly introduced in 135ce25
"tdf#146487 Don't show generic diagram title when there is an empty title
given", which caused CppunitTest_chart2_export2 to fail with

> /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62: runtime error: load of value 222, which is not a valid value for type 'bool'
>     #0 0x7f95cd9ed87c in oox::drawingml::chart::PlotAreaConverter::isSingleSeriesTitle() const /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62
>     #1 0x7f95cd9e506f in oox::drawingml::chart::ChartSpaceConverter::convertFromModel(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&) /oox/source/drawingml/chart/chartspaceconverter.cxx:189:53
>     #2 0x7f95cd9b6c34 in oox::drawingml::chart::ChartConverter::convertFromModel(oox::core::XmlFilterBase&, oox::drawingml::chart::ChartSpaceModel&, com::sun::star::uno::Reference<com::sun::star::chart2::XChartDocument> const&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&, com::sun::star::awt::Size const&) /oox/source/drawingml/chart/chartconverter.cxx:93:20
>     #3 0x7f95ce548f59 in oox::drawingml::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /oox/source/drawingml/shape.cxx:2245:50
>     #4 0x7f95438150b2 in oox::xls::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /sc/source/filter/oox/drawingfragment.cxx:113:30
>     #5 0x7f95ce5267bb in oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase&, rtl::OUString const&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, bool, bool, basegfx::B2DHomMatrix&, oox::drawingml::FillProperties const&, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:1964:9
>     #6 0x7f95ce4edb54 in oox::drawingml::Shape::addShape(oox::core::XmlFilterBase&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, basegfx::B2DHomMatrix const&, oox::drawingml::FillProperties const&, std::__debug::map<rtl::OUString, std::shared_ptr<oox::drawingml::Shape>, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, std::shared_ptr<oox::drawingml::Shape> > > >*, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:366:41
>     #7 0x7f954381ef79 in oox::xls::DrawingFragment::onEndElement() /sc/source/filter/oox/drawingfragment.cxx:335:30
>     #8 0x7f95cdcaee54 in oox::core::ContextHandler2Helper::implEndElement(int) /oox/source/core/contexthandler2.cxx:125:9
>     #9 0x7f95cdd5c116 in oox::core::FragmentHandler2::endFastElement(int) /oox/source/core/fragmenthandler2.cxx:91:5
>     #10 0x7f95caf68fca in (anonymous namespace)::Entity::endElement() /sax/source/fastparser/fastparser.cxx:514:27
>     #11 0x7f95caf68998 in sax_fastparser::FastSaxParserImpl::callbackEndElement() /sax/source/fastparser/fastparser.cxx:1331:17
>     #12 0x7f95caf58444 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:338:18
>     #13 0x7f960adebeda in xmlParseEndTag2 /workdir/UnpackedTarball/libxml2/parser.c:10090:2
>     #14 0x7f960ad929b5 in xmlParseTryOrFinish /workdir/UnpackedTarball/libxml2/parser.c:11868:14
>     #15 0x7f960ad86334 in xmlParseChunk /workdir/UnpackedTarball/libxml2/parser.c:12151:5
>     #16 0x7f95caf53231 in sax_fastparser::FastSaxParserImpl::parse() /sax/source/fastparser/fastparser.cxx:1085:21
>     #17 0x7f95caf4cd18 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:890:9
>     #18 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #19 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #20 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #21 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #22 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #23 0x7f95441ceaa8 in oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&) /sc/source/filter/oox/workbookhelper.cxx:1046:27
>     #24 0x7f95442797f1 in oox::xls::WorksheetGlobals::finalizeDrawings() /sc/source/filter/oox/worksheethelper.cxx:1373:9
>     #25 0x7f95442789e0 in oox::xls::WorksheetGlobals::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:996:5
>     #26 0x7f954428744d in oox::xls::WorksheetHelper::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:1637:17
>     #27 0x7f95441771de in oox::xls::WorkbookFragment::finalizeImport() /sc/source/filter/oox/workbookfragment.cxx:511:18
>     #28 0x7f95cdd5b3ae in oox::core::FragmentHandler2::endDocument() /oox/source/core/fragmenthandler2.cxx:53:5
>     #29 0x7f95caf4cfc2 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:896:36
>     #30 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #31 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #32 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #33 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #34 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #35 0x7f95435c4daa in oox::xls::ExcelFilter::importDocument() /sc/source/filter/oox/excelfilter.cxx:113:25
>     #36 0x7f95cdcf953b in oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/core/filterbase.cxx:488:49
>     #37 0x7f95435c7733 in oox::xls::ExcelFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sc/source/filter/oox/excelfilter.cxx:176:25
>     #38 0x7f95857c5b40 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sfx2/source/doc/objstor.cxx:2393:34
>     #39 0x7f9585781c6a in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:761:23
>     #40 0x7f95859a9652 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1980:36
>     #41 0x7f95862145e9 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) /sfx2/source/view/frmload.cxx:720:28
>     #42 0x7f95536a9900 in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1176:37
>     #43 0x7f95536a091b in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:412:20
>     #44 0x7f9553698f59 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) /framework/source/loadenv/loadenv.cxx:308:5
>     #45 0x7f95536946e7 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/loadenv/loadenv.cxx:168:14
>     #46 0x7f955376867d in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx:591:16
>     #47 0x7f95537688a6 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx
>     #48 0x7f9569f7cafa in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:71:62
>     #49 0x7f9580718c56 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /test/source/unoapi_test.cxx:126:19
>     #50 0x7f9580717ef8 in UnoApiTest::load(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:108:5
>     #51 0x7f9580719254 in UnoApiTest::loadFromFile(std::basic_string_view<char16_t, std::char_traits<char16_t> >, char const*) /test/source/unoapi_test.cxx:132:5
>     #52 0x7f95d8bf1018 in testTdf123647::TestBody() /chart2/qa/extras/chart2export2.cxx:1242:5

(<https://ci.libreoffice.org//job/lo_ubsan/3048/>)

Change-Id: I870d811e78b8c55b84627ae609f98f623465dd9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162294
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
(cherry picked from commit 3fb9859)
tdf-gerrit pushed a commit that referenced this pull request Oct 3, 2024
...in code newly introduced in 135ce25
"tdf#146487 Don't show generic diagram title when there is an empty title
given", which caused CppunitTest_chart2_export2 to fail with

> /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62: runtime error: load of value 222, which is not a valid value for type 'bool'
>     #0 0x7f95cd9ed87c in oox::drawingml::chart::PlotAreaConverter::isSingleSeriesTitle() const /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62
>     #1 0x7f95cd9e506f in oox::drawingml::chart::ChartSpaceConverter::convertFromModel(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&) /oox/source/drawingml/chart/chartspaceconverter.cxx:189:53
>     #2 0x7f95cd9b6c34 in oox::drawingml::chart::ChartConverter::convertFromModel(oox::core::XmlFilterBase&, oox::drawingml::chart::ChartSpaceModel&, com::sun::star::uno::Reference<com::sun::star::chart2::XChartDocument> const&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, com::sun::star::awt::Point const&, com::sun::star::awt::Size const&) /oox/source/drawingml/chart/chartconverter.cxx:93:20
>     #3 0x7f95ce548f59 in oox::drawingml::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /oox/source/drawingml/shape.cxx:2245:50
>     #4 0x7f95438150b2 in oox::xls::Shape::finalizeXShape(oox::core::XmlFilterBase&, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&) /sc/source/filter/oox/drawingfragment.cxx:113:30
>     #5 0x7f95ce5267bb in oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase&, rtl::OUString const&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, bool, bool, basegfx::B2DHomMatrix&, oox::drawingml::FillProperties const&, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:1964:9
>     #6 0x7f95ce4edb54 in oox::drawingml::Shape::addShape(oox::core::XmlFilterBase&, oox::drawingml::Theme const*, com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> const&, basegfx::B2DHomMatrix const&, oox::drawingml::FillProperties const&, std::__debug::map<rtl::OUString, std::shared_ptr<oox::drawingml::Shape>, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, std::shared_ptr<oox::drawingml::Shape> > > >*, std::shared_ptr<oox::drawingml::Shape>) /oox/source/drawingml/shape.cxx:366:41
>     #7 0x7f954381ef79 in oox::xls::DrawingFragment::onEndElement() /sc/source/filter/oox/drawingfragment.cxx:335:30
>     #8 0x7f95cdcaee54 in oox::core::ContextHandler2Helper::implEndElement(int) /oox/source/core/contexthandler2.cxx:125:9
>     #9 0x7f95cdd5c116 in oox::core::FragmentHandler2::endFastElement(int) /oox/source/core/fragmenthandler2.cxx:91:5
>     #10 0x7f95caf68fca in (anonymous namespace)::Entity::endElement() /sax/source/fastparser/fastparser.cxx:514:27
>     #11 0x7f95caf68998 in sax_fastparser::FastSaxParserImpl::callbackEndElement() /sax/source/fastparser/fastparser.cxx:1331:17
>     #12 0x7f95caf58444 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:338:18
>     #13 0x7f960adebeda in xmlParseEndTag2 /workdir/UnpackedTarball/libxml2/parser.c:10090:2
>     #14 0x7f960ad929b5 in xmlParseTryOrFinish /workdir/UnpackedTarball/libxml2/parser.c:11868:14
>     #15 0x7f960ad86334 in xmlParseChunk /workdir/UnpackedTarball/libxml2/parser.c:12151:5
>     #16 0x7f95caf53231 in sax_fastparser::FastSaxParserImpl::parse() /sax/source/fastparser/fastparser.cxx:1085:21
>     #17 0x7f95caf4cd18 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:890:9
>     #18 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #19 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #20 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #21 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #22 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #23 0x7f95441ceaa8 in oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&) /sc/source/filter/oox/workbookhelper.cxx:1046:27
>     #24 0x7f95442797f1 in oox::xls::WorksheetGlobals::finalizeDrawings() /sc/source/filter/oox/worksheethelper.cxx:1373:9
>     #25 0x7f95442789e0 in oox::xls::WorksheetGlobals::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:996:5
>     #26 0x7f954428744d in oox::xls::WorksheetHelper::finalizeDrawingImport() /sc/source/filter/oox/worksheethelper.cxx:1637:17
>     #27 0x7f95441771de in oox::xls::WorkbookFragment::finalizeImport() /sc/source/filter/oox/workbookfragment.cxx:511:18
>     #28 0x7f95cdd5b3ae in oox::core::FragmentHandler2::endDocument() /oox/source/core/fragmenthandler2.cxx:53:5
>     #29 0x7f95caf4cfc2 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:896:36
>     #30 0x7f95caf6e950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13
>     #31 0x7f95cdce50d1 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #32 0x7f95cdce5868 in oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
>     #33 0x7f95cddbb234 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
>     #34 0x7f95cddb9b8d in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:344:12
>     #35 0x7f95435c4daa in oox::xls::ExcelFilter::importDocument() /sc/source/filter/oox/excelfilter.cxx:113:25
>     #36 0x7f95cdcf953b in oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/core/filterbase.cxx:488:49
>     #37 0x7f95435c7733 in oox::xls::ExcelFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sc/source/filter/oox/excelfilter.cxx:176:25
>     #38 0x7f95857c5b40 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sfx2/source/doc/objstor.cxx:2393:34
>     #39 0x7f9585781c6a in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:761:23
>     #40 0x7f95859a9652 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1980:36
>     #41 0x7f95862145e9 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) /sfx2/source/view/frmload.cxx:720:28
>     #42 0x7f95536a9900 in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1176:37
>     #43 0x7f95536a091b in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:412:20
>     #44 0x7f9553698f59 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) /framework/source/loadenv/loadenv.cxx:308:5
>     #45 0x7f95536946e7 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/loadenv/loadenv.cxx:168:14
>     #46 0x7f955376867d in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx:591:16
>     #47 0x7f95537688a6 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/desktop.cxx
>     #48 0x7f9569f7cafa in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:71:62
>     #49 0x7f9580718c56 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /test/source/unoapi_test.cxx:126:19
>     #50 0x7f9580717ef8 in UnoApiTest::load(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:108:5
>     #51 0x7f9580719254 in UnoApiTest::loadFromFile(std::basic_string_view<char16_t, std::char_traits<char16_t> >, char const*) /test/source/unoapi_test.cxx:132:5
>     #52 0x7f95d8bf1018 in testTdf123647::TestBody() /chart2/qa/extras/chart2export2.cxx:1242:5

(<https://ci.libreoffice.org//job/lo_ubsan/3048/>)

Change-Id: I870d811e78b8c55b84627ae609f98f623465dd9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162294
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
(cherry picked from commit 3fb9859)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174442
Tested-by: Stephan Bergmann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant