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

Removed entry "fx." from DocumentList.xml (Danish) that can make valid syntax invalid #32

Closed
wants to merge 1 commit into from

Conversation

jhertel
Copy link

@jhertel jhertel commented Mar 21, 2022

The replacement of "fx." to "fx" is not thought through; it can change a valid sentence into an invalid one.

It was clearly originally added because "fx." looks like a simple misspelling of the abbreviation "fx". (Normally abbreviations in Danish end in a ".", but there are a few exceptions such as this.) So the simple original thought behind the rule is to always replace "fx." with "fx" to correct a common misspelling.

But since it is perfectly valid for "fx" to be placed in the end of a sentence, right before the full stop ("."), resulting in the correct character sequence "fx.", this rule will often change correct syntax with incorrect (I have often experienced exactly this, prompting me to finally do something about it). An example full and absolutely correct Danish sentence including "fx." could be "Vi kunne jo tage bussen, fx.". Because of this replacement rule, the full stop at the end of the sentence is removed, resulting in an incorrect sentence without full stop at the end.

It is fine to replace obvious mistakes that are always mistakes (that's what this list is partly about), but we should never replace sequences of characters that can be in fact be perfectly valid and correct in normal writing. And "fx." is a case of that.

Therefore this rule should be removed.

I also added a comment to explain why it shouldn't be added again, if someone gets the original simple thought again without thinking it through. I assume the XML reader is a full-blown XML reader that can handle XML comments. Also, a single comment like this only affects performance absolutely minimally.

The replacement of "fx." to "fx" is not thought through. It was clearly originally added because "fx." looks like a simple misspelling of the abbreviation "fx". (Normally abbreviations in Danish end in a ".", but there are a few exceptions such as this.) So the simple original thought behind the rule is to always replace "fx." with "fx" to correct a common misspelling.

But since it is perfectly valid for "fx" to be placed in the end of a sentence, right before the full stop ("."), resulting in the correct character sequence "fx.", this rule will often change correct syntax with incorrect (I have often experienced exactly this, prompting me to finally do something about it). An example full and absolutely correct Danish sentence including "fx." could be "Vi kunne jo tage bussen, fx.". Because of this replacement rule, the full stop at the end of the sentence is removed, resulting in an incorrect sentence without full stop at the end. 

It is fine to replace obvious mistakes that are always mistakes (that's what this list is partly about), but we should never replace sequences of characters that can be in fact be perfectly valid and correct in normal writing. And "fx." is a case of that.

Therefore this rule should be removed. 

I also added a comment to explain why it shouldn't be added again, if someone gets the original simple thought again without thinking it through. I assume the XML reader is a full-blown XML reader that can handle XML comments. Also, a single comment like this only affects performance absolutely minimally.
@cloph
Copy link
Contributor

cloph commented May 10, 2022

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

Since this is a small one, I created https://gerrit.libreoffice.org/c/core/+/134107 for it. Please leave a comment on that URL in case you want to have attribution for it.

@cloph cloph closed this May 10, 2022
GeassCore pushed a commit to GeassCore/core that referenced this pull request Aug 17, 2022
This reverts commit eabcfb3.
Conflicts:
	sw/source/core/doc/textboxhelper.cxx

It caused UITest_writer_tests4 to fail in an ASan build with
> ==2987325==ERROR: AddressSanitizer: heap-use-after-free on address 0x6130000e5048 at pc 0x7f20cb3112ac bp 0x7f1e62de92d0 sp 0x7f1e62de92c8
> WRITE of size 8 at 0x6130000e5048 thread T47
>  #0 in SwFrameFormat::SetOtherTextBoxFormat(SwTextBoxNode*) at sw/inc/frmfmt.hxx:106:77
>  LibreOffice#1 in SwTextBoxNode::~SwTextBoxNode() at sw/source/core/doc/textboxhelper.cxx:1680:30
>  LibreOffice#2 in SwFrameFormat::~SwFrameFormat() at sw/source/core/layout/atrfrm.cxx:2564:9
>  LibreOffice#3 in SwDrawFrameFormat::~SwDrawFrameFormat() at sw/source/core/layout/atrfrm.cxx:3455:1
>  LibreOffice#4 in SwDrawFrameFormat::~SwDrawFrameFormat() at sw/source/core/layout/atrfrm.cxx:3453:1
>  LibreOffice#5 in SwFrameFormats::DeleteAndDestroyAll(bool) at sw/source/core/doc/docfmt.cxx:2115:9
>  LibreOffice#6 in SwDoc::~SwDoc() at sw/source/core/doc/docnew.cxx:565:28
>  LibreOffice#7 in SwDoc::release() at sw/source/core/doc/doc.cxx:118:9
>  LibreOffice#8 in rtl::Reference<SwDoc>::clear() at include/rtl/ref.hxx:196:19
>  LibreOffice#9 in SwDocShell::RemoveLink() at sw/source/uibase/app/docshini.cxx:444:16
>  LibreOffice#10 in SwDocShell::~SwDocShell() at sw/source/uibase/app/docshini.cxx:372:5
>  LibreOffice#11 in SwDocShell::~SwDocShell() at sw/source/uibase/app/docshini.cxx:362:1
>  LibreOffice#12 in SwDocShell::~SwDocShell() at sw/source/uibase/app/docshini.cxx:362:1
>  LibreOffice#13 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:163:29
>  LibreOffice#14 in tools::SvRef<SfxObjectShell>::~SvRef() at include/tools/ref.hxx:56:36
>  LibreOffice#15 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() at sfx2/source/doc/sfxbasemodel.cxx:245:5
>  LibreOffice#16 in void std::destroy_at<IMPL_SfxBaseModel_DataContainer>(IMPL_SfxBaseModel_DataContainer*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/stl_construct.h:88:15
>  LibreOffice#17 in void std::allocator_traits<std::allocator<IMPL_SfxBaseModel_DataContainer> >::destroy<IMPL_SfxBaseModel_DataContainer>(std::allocator<IMPL_SfxBaseModel_DataContainer>&, IMPL_SfxBaseModel_DataContainer*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/alloc_traits.h:537:4
>  LibreOffice#18 in std::_Sp_counted_ptr_inplace<IMPL_SfxBaseModel_DataContainer, std::allocator<IMPL_SfxBaseModel_DataContainer>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:528:2
>  LibreOffice#19 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:168:6
>  LibreOffice#20 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:705:11
>  LibreOffice#21 in std::__shared_ptr<IMPL_SfxBaseModel_DataContainer, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:1154:31
>  LibreOffice#22 in std::__shared_ptr<IMPL_SfxBaseModel_DataContainer, (__gnu_cxx::_Lock_policy)2>::reset() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:1272:9
>  LibreOffice#23 in SfxBaseModel::dispose() at sfx2/source/doc/sfxbasemodel.cxx:757:13
>  LibreOffice#24 in SwXTextDocument::dispose() at sw/source/uibase/uno/unotxdoc.cxx:549:19
>  LibreOffice#25 in SfxBaseModel::close(unsigned char) at sfx2/source/doc/sfxbasemodel.cxx:1482:5
>  LibreOffice#26 in SwXTextDocument::close(unsigned char) at sw/source/uibase/uno/unotxdoc.cxx:562:19
>  LibreOffice#27 in SfxBaseModel::dispose() at sfx2/source/doc/sfxbasemodel.cxx:718:13
>  LibreOffice#28 in SwXTextDocument::dispose() at sw/source/uibase/uno/unotxdoc.cxx:549:19
>  LibreOffice#29 in 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:77:5
>  LibreOffice#30 in 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:233:13
>  LibreOffice#31 in unoInterfaceProxyDispatch at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
>  LibreOffice#32 in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const at binaryurp/source/incomingrequest.cxx:235:13
>  LibreOffice#33 in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:78:26
>  LibreOffice#34 in request at binaryurp/source/reader.cxx:85:9
>  LibreOffice#35 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100:17
>  LibreOffice#36 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:164:31
>  LibreOffice#37 in threadFunc at include/osl/thread.hxx:189:15
>  LibreOffice#38 in osl_thread_start_Impl(void*) at sal/osl/unx/thread.cxx:264:9
>  LibreOffice#39 in start_thread at <null>
>  LibreOffice#40 in __GI___clone3 at <null>
>
> 0x6130000e5048 is located 328 bytes inside of 376-byte region [0x6130000e4f00,0x6130000e5078)
> freed by thread T47 here:
>  #0 in operator delete(void*, unsigned long) at ~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
>  LibreOffice#1 in SwFlyFrameFormat::~SwFlyFrameFormat() at sw/source/core/layout/atrfrm.cxx:2912:1
>  LibreOffice#2 in SwFrameFormats::DeleteAndDestroyAll(bool) at sw/source/core/doc/docfmt.cxx:2115:9
>  LibreOffice#3 in SwDoc::~SwDoc() at sw/source/core/doc/docnew.cxx:565:28
>  LibreOffice#4 in SwDoc::release() at sw/source/core/doc/doc.cxx:118:9
>  LibreOffice#5 in rtl::Reference<SwDoc>::clear() at include/rtl/ref.hxx:196:19
>  LibreOffice#6 in SwDocShell::RemoveLink() at sw/source/uibase/app/docshini.cxx:444:16
>  LibreOffice#7 in SwDocShell::~SwDocShell() at sw/source/uibase/app/docshini.cxx:372:5
>  LibreOffice#8 in SwDocShell::~SwDocShell() at sw/source/uibase/app/docshini.cxx:362:1
>  LibreOffice#9 in SwDocShell::~SwDocShell() at sw/source/uibase/app/docshini.cxx:362:1
>  LibreOffice#10 in SvRefBase::ReleaseRef() at include/tools/ref.hxx:163:29
>  LibreOffice#11 in tools::SvRef<SfxObjectShell>::~SvRef() at include/tools/ref.hxx:56:36
>  LibreOffice#12 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() at sfx2/source/doc/sfxbasemodel.cxx:245:5
>  LibreOffice#13 in void std::destroy_at<IMPL_SfxBaseModel_DataContainer>(IMPL_SfxBaseModel_DataContainer*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/stl_construct.h:88:15
>  LibreOffice#14 in void std::allocator_traits<std::allocator<IMPL_SfxBaseModel_DataContainer> >::destroy<IMPL_SfxBaseModel_DataContainer>(std::allocator<IMPL_SfxBaseModel_DataContainer>&, IMPL_SfxBaseModel_DataContainer*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/alloc_traits.h:537:4
>  LibreOffice#15 in std::_Sp_counted_ptr_inplace<IMPL_SfxBaseModel_DataContainer, std::allocator<IMPL_SfxBaseModel_DataContainer>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:528:2
>  LibreOffice#16 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:168:6
>  LibreOffice#17 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:705:11
>  LibreOffice#18 in std::__shared_ptr<IMPL_SfxBaseModel_DataContainer, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:1154:31
>  LibreOffice#19 in std::__shared_ptr<IMPL_SfxBaseModel_DataContainer, (__gnu_cxx::_Lock_policy)2>::reset() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:1272:9
>
> previously allocated by thread T10 here:
>  #0 in operator new(unsigned long) at ~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
>  LibreOffice#1 in SwDoc::MakeFlyFrameFormat(rtl::OUString const&, SwFrameFormat*) at sw/source/core/doc/docfmt.cxx:756:33
>  LibreOffice#2 in SwDoc::MakeFlySection_(SwPosition const&, SwContentNode const&, RndStdIds, SfxItemSet const*, SwFrameFormat*) at sw/source/core/doc/doclay.cxx:171:33
>  LibreOffice#3 in SwDoc::MakeFlySection(RndStdIds, SwPosition const*, SfxItemSet const*, SwFrameFormat*, bool) at sw/source/core/doc/doclay.cxx:337:19
>  LibreOffice#4 in SwXFrame::attachToRange(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&, SwPaM const*) at sw/source/core/unocore/unoframe.cxx:2821:29
>  LibreOffice#5 in SwXFrame::attach(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sw/source/core/unocore/unoframe.cxx:3115:9
>  LibreOffice#6 in SwXTextFrame::attach(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sw/source/core/unocore/unoframe.cxx:3346:15
>  LibreOffice#7 in SwXText::insertTextContent(com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&, com::sun::star::uno::Reference<com::sun::star::text::XTextContent> const&, unsigned char) at sw/source/core/unocore/unotext.cxx:615:15
>  LibreOffice#8 in SwXText::insertTextContentWithProperties(com::sun::star::uno::Reference<com::sun::star::text::XTextContent> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sw/source/core/unocore/unotext.cxx:1472:5
>  LibreOffice#9 in non-virtual thunk to SwXText::insertTextContentWithProperties(com::sun::star::uno::Reference<com::sun::star::text::XTextContent> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sw/source/core/unocore/unotext.cxx
>  LibreOffice#10 in SwTextBoxHelper::create(SwFrameFormat*, SdrObject*, bool) at sw/source/core/doc/textboxhelper.cxx:100:29
>  LibreOffice#11 in SwXShape::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) at sw/source/core/unocore/unodraw.cxx:1165:25
>  LibreOffice#12 in SdXMLShapeContext::SetStyle(bool) at xmloff/source/draw/ximpshap.cxx:701:27
>  LibreOffice#13 in SdXMLCustomShapeContext::startFastElement(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) at xmloff/source/draw/ximpshap.cxx:3545:5
>  LibreOffice#14 in SvXMLImport::startFastElement(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) at xmloff/source/core/xmlimp.cxx:805:15
>  LibreOffice#15 in (anonymous namespace)::Entity::startElement((anonymous namespace)::Event const*) at sax/source/fastparser/fastparser.cxx:468:27
>  LibreOffice#16 in sax_fastparser::FastSaxParserImpl::callbackStartElement(unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, unsigned char const**) at sax/source/fastparser/fastparser.cxx:1304:21
>  LibreOffice#17 in (anonymous namespace)::call_callbackStartElement(void*, unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, int, unsigned char const**) at sax/source/fastparser/fastparser.cxx:331:18
>  LibreOffice#18 in xmlParseStartTag2 at workdir/UnpackedTarball/libxml2/parser.c:9658:6
>  LibreOffice#19 in xmlParseTryOrFinish at workdir/UnpackedTarball/libxml2/parser.c:11453:14

Change-Id: I752190e05fc3c282b75021724527f623f56ee6a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125977
Tested-by: Jenkins
Tested-by: René Engelhard <rene@debian.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 4fb7967)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125906
tdf-gerrit pushed a commit that referenced this pull request Dec 29, 2022
...avoiding

> /writerfilter/source/dmapper/PropertyMap.cxx:324:71: runtime error: -2539 is outside the range of representable values of type 'unsigned int'
>     #0 0x7f80e9a3b6c3 in writerfilter::dmapper::PropertyMap::dumpXml() const /writerfilter/source/dmapper/PropertyMap.cxx:324:71
>     #1 0x7f80e928eccb in writerfilter::dmapper::DomainMapperTableHandler::endTableGetTableStyle(writerfilter::dmapper::TableInfo&, std::__debug::vector<com::sun::star::beans::PropertyValue, std::allocator<com::sun::star::beans::PropertyValue> >&, bool) /writerfilter/source/dmapper/DomainMapperTableHandler.cxx:434:40
>     #2 0x7f80e92b4b8f in writerfilter::dmapper::DomainMapperTableHandler::endTable(unsigned int, bool) /writerfilter/source/dmapper/DomainMapperTableHandler.cxx:1377:30
>     #3 0x7f80e9c289de in writerfilter::dmapper::TableManager::resolveCurrentTable() /writerfilter/source/dmapper/TableManager.cxx:409:33
>     #4 0x7f80e9c297a1 in writerfilter::dmapper::TableManager::endLevel() /writerfilter/source/dmapper/TableManager.cxx:427:9
>     #5 0x7f80e936a997 in writerfilter::dmapper::DomainMapperTableManager::endLevel() /writerfilter/source/dmapper/DomainMapperTableManager.cxx:497:19
>     #6 0x7f80e9c256d1 in writerfilter::dmapper::TableManager::endParagraphGroup() /writerfilter/source/dmapper/TableManager.cxx:338:9
>     #7 0x7f80e9205974 in writerfilter::dmapper::DomainMapper::lcl_endParagraphGroup() /writerfilter/source/dmapper/DomainMapper.cxx:3511:35
>     #8 0x7f80e984598e in writerfilter::LoggedStream::endParagraphGroup() /writerfilter/source/dmapper/LoggedResources.cxx:108:5
>     #9 0x7f80e9d9addf in writerfilter::ooxml::OOXMLFastContextHandler::endParagraphGroup() /writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:452:23
>     #10 0x7f80ea042658 in writerfilter::ooxml::OOXMLFactory_wml::endAction(writerfilter::ooxml::OOXMLFastContextHandler*) /workdir/CustomTarget/writerfilter/source/ooxml/OOXMLFactory_wml.cxx:7574:19
>     #11 0x7f80e9d8822a in writerfilter::ooxml::OOXMLFactory::endAction(writerfilter::ooxml::OOXMLFastContextHandler*) /writerfilter/source/ooxml/OOXMLFactory.cxx:157:19
>     #12 0x7f80e9d944eb in writerfilter::ooxml::OOXMLFastContextHandler::lcl_endFastElement(int) /writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:242:5
>     #13 0x7f80e9d941da in writerfilter::ooxml::OOXMLFastContextHandler::endFastElement(int) /writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:225:9
>     #14 0x7f80f44ffe2a in (anonymous namespace)::Entity::endElement() /sax/source/fastparser/fastparser.cxx:515:27
>     #15 0x7f80f44ff818 in sax_fastparser::FastSaxParserImpl::callbackEndElement() /sax/source/fastparser/fastparser.cxx:1343:17
>     #16 0x7f80f44ef554 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:339:18
>     #17 0x7f8179cde54a in xmlParseEndTag2 /workdir/UnpackedTarball/libxml2/parser.c:9742:2
>     #18 0x7f8179c8ced0 in xmlParseTryOrFinish /workdir/UnpackedTarball/libxml2/parser.c:11642:14
>     #19 0x7f8179c7acc9 in xmlParseChunk /workdir/UnpackedTarball/libxml2/parser.c:12351:13
>     #20 0x7f80f44ea4f1 in sax_fastparser::FastSaxParserImpl::parse() /sax/source/fastparser/fastparser.cxx:1099:21
>     #21 0x7f80f44e4146 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:904:9
>     #22 0x7f80f4505300 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1482:13
>     #23 0x7f80e9d46e98 in writerfilter::ooxml::OOXMLDocumentImpl::resolve(writerfilter::Stream&) /writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:508:18
>     #24 0x7f80e9cfed05 in (anonymous namespace)::WriterFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /writerfilter/source/filter/WriterFilter.cxx:208:24
>     #25 0x7f8149202866 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sfx2/source/doc/objstor.cxx:2272:34
>     #26 0x7f81491c2434 in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:739:23
>     #27 0x7f81493c9870 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1937:36
>     #28 0x7f8149b20d71 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
>     #29 0x7f810e00256b in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1167:37
>     #30 0x7f810dff896b in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:403:20
>     #31 0x7f810dff0dec 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
>     #32 0x7f810dfec180 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
>     #33 0x7f810e0b541d 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:604:16
>     #34 0x7f810e0b5646 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
>     #35 0x7f812a050c25 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:70:62
>     #36 0x7f81444fcad9 in UnoApiTest::load(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:115:11
>     #37 0x7f812a8ae042 in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) /sw/qa/unit/swmodeltestbase.cxx:449:20
>     #38 0x7f812a8b9452 in SwModelTestBase::load(char const*, char const*) /sw/qa/inc/swmodeltestbase.hxx:351:16
>     #39 0x7f812a8af516 in SwModelTestBase::loadAndSave(char const*) /sw/qa/unit/swmodeltestbase.cxx:502:5
>     #40 0x7f814fcfe242 in testTableThemePreservation::TestBody() /sw/qa/extras/ooxmlexport/ooxmlexport3.cxx:888:5

during CppunitTest_sw_ooxmlexport3
(<https://ci.libreoffice.org//job/lo_ubsan/2629/>).

(The overload for is_integral parameters is needed now to avoid ambiguity errors
when integer types other than sal_uInt32 could also match the newly added float
overload.)

Change-Id: I6482bccef2442655359c71e13f0c9bfe7e4d9dd4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144855
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
tdf-gerrit pushed a commit that referenced this pull request Feb 1, 2023
An ASan UITest_writer_tests7
UITEST_TEST_NAME=tdf135938.tdf135938.test_tdf135938_cross_reference_update
occasionally failed for me with

> ==1994973==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f00014d718 at pc 0x7f95f4946ffa bp 0x7f95907fd720 sp 0x7f95907fd718
> READ of size 8 at 0x60f00014d718 thread T33
>  #0 in std::__cxx1998::vector<std::unique_ptr<SvLBoxItem, std::default_delete<SvLBoxItem>>, std::allocator<std::unique_ptr<SvLBoxItem, std::default_delete<SvLBoxItem>>>>::size() const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:988:40
>  #1 in SvTreeListEntry::ItemCount() const at vcl/source/treelist/treelistentry.cxx:110:20
>  #2 in SvTabListBox::GetEntryText(SvTreeListEntry const*, unsigned short) at vcl/source/treelist/svtabbx.cxx:289:37
>  #3 in SvTabListBox::GetEntryText(SvTreeListEntry*) const at vcl/source/treelist/svtabbx.cxx:280:12
>  #4 in TreeListEntryUIObject::get_state() at vcl/source/treelist/uiobject.cxx:119:32
>  #5 in UIObjectUnoObj::getState() at vcl/source/uitest/uno/uiobject_uno.cxx:164:29
>  #6 in non-virtual thunk to UIObjectUnoObj::getState() at vcl/source/uitest/uno/uiobject_uno.cxx
>  #7 in 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:77:5
>  #8 in 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:233:13
>  #9 in unoInterfaceProxyDispatch at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
>  #10 in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny>>*) const at binaryurp/source/incomingrequest.cxx:236:13
>  #11 in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:79:26
>  #12 in request at binaryurp/source/reader.cxx:86:9
>  #13 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100:17
>  #14 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:165:31
>
> 0x60f00014d718 is located 120 bytes inside of 168-byte region [0x60f00014d6a0,0x60f00014d748)
> freed by thread T0 here:
>  #0 in operator delete(void*, unsigned long) at ~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
>  #1 in SvTreeListEntry::~SvTreeListEntry() at vcl/source/treelist/treelistentry.cxx:62:1
>  #2 in std::default_delete<SvTreeListEntry>::operator()(SvTreeListEntry*) const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/unique_ptr.h:102:2
>  #3 in std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>::~unique_ptr() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/unique_ptr.h:407:4
>  #4 in void std::destroy_at<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:88:15
>  #5 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:149:7
>  #6 in void std::_Destroy_aux<false>::__destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:163:6
>  #7 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:195:7
>  #8 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/alloc_traits.h:947:7
>  #9 in std::__cxx1998::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::_M_erase_at_end(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:1932:6
>  #10 in std::__cxx1998::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:1601:9
>  #11 in std::__debug::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/debug/vector:729:9
>  #12 in SvTreeListEntry::ClearChildren() at vcl/source/treelist/treelistentry.cxx:28:16
>  #13 in SvTreeList::Clear() at vcl/source/treelist/treelist.cxx:123:16
>  #14 in SvTreeListBox::Clear() at vcl/source/treelist/treelistbox.cxx:422:17
>  #15 in SalInstanceTreeView::clear() at vcl/source/app/salvtables.cxx:4240:18
>  #16 in SwFieldRefPage::Reset(SfxItemSet const*) at sw/source/ui/fldui/fldref.cxx:175:16
>  #17 in SwFieldPage::EditNewField(bool) at sw/source/ui/fldui/fldpage.cxx:111:5
>  #18 in SwFieldDlg::ReInitTabPage(std::basic_string_view<char, std::char_traits<char>>, bool) at sw/source/ui/fldui/fldtdlg.cxx:218:16
>  #19 in SwFieldDlg::Activate() at sw/source/ui/fldui/fldtdlg.cxx:239:9
>  #20 in SwChildWinWrapper::UpdateHdl(Timer*) at sw/source/uibase/fldui/fldwrap.cxx:42:26
>  #21 in SwChildWinWrapper::LinkStubUpdateHdl(void*, Timer*) at sw/source/uibase/fldui/fldwrap.cxx:39:1
>  #22 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45
>  #23 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21
>  #24 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:481:20
>  #25 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13
>  #26 in SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:161:53
>  #27 in SvpSalInstance::ImplYield(bool, bool) at vcl/headless/svpinst.cxx:399:17
>  #28 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:471:21
>  #29 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:475:48
>  #30 in Application::Yield() at vcl/source/app/svapp.cxx:559:5
>  #31 in Application::Execute() at vcl/source/app/svapp.cxx:453:13
>  #32 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1604:13

causing

> ERROR: test_tdf135938_cross_reference_update (tdf135938.tdf135938)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "uitest/uitest/test.py", line 125, in execute_dialog_through_command
>     yield xDialog
>   File "uitest/uitest/test.py", line 140, in execute_modeless_dialog_through_command
>     yield xDialog
>   File "sw/qa/uitest/writer_tests7/tdf135938.py", line 40, in test_tdf135938_cross_reference_update
>     self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"])
>   File "uitest/uitest/uihelper/common.py", line 13, in get_state_as_dict
>     return convert_property_values_to_dict(ui_object.getState())
> uitest.uihelper.common.com.sun.star.lang.DisposedException: Binary URP bridge disposed during call at binaryurp/source/bridge.cxx:613

The issue apparently is that TreeListEntryUIObject UNO objects, introduced in
71f562f "uitest: support tree lists", reference
SvTreeListEntry instances by pointers that can apparently go stale while those
UNO objects are still alive.  I'm not sure there would be an easy fix for this,
short of making those SvTreeListEntry instances ref-counted, or ripping out
UITest support for those TreeListEntryUIObjects again.

However, that underlying issue would presumably not be of practical concern if
the test_tdf135938_cross_reference_update Python code would have waited for
processEventsToIdle between its

>                 xInsert.executeAction("CLICK", tuple())

and the following block

>                 self.assertEqual("2", get_state_as_dict(xSelect)["Children"])
>                 self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"])
>                 self.assertEqual("DEF", get_state_as_dict(xSelect.getChild(1))["Text"])

That way, there should be no more opportunity for the pointers in the passed-out
TreeListEntryUIObjects to become stale while the Python code accesses them.

And in Python UITest code, having to follow a call to executeAction by a call to
processEventsToIdle appears to be a common and recurring requirement, just look
at the most recent af1ca68 "another stab at
making this test reliable", d183dae
"tdf#153161: (Ab)use a call to XTextRange::getString to flush edits",
3cc6b87 "make an effort to fix the
UITest_inputLine intermittent failure", f466854
"tdf#150443 sw: fix crash of rejecting table row deletion".

So make executeAction always call ProcessEventsToIdle, to simplify this and
hopefully make UITests more robust.  (Removing any now-redundant calls to
processEventsToIdle, following calls to executeAction, from Python test code is
left as follow-up clean up for now.)

(I /think/ that the implementation of UIObjectUnoObj::executeAction could be
simplified now, as waiting for Scheduler::ProcessEventsToIdle() should already
make sure that aIdle has been processed, removing the need for the Notifier.
But lets leave that as a follow-up TODO for now.)

Change-Id: I41a5d51515dedaae44fb810b0ad3b0264c90abf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146434
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
tdf-gerrit pushed a commit that referenced this pull request Feb 1, 2023
sporadically reproducible with tsan and
./instdir/program/soffice.bin --headless --convert-to pdf ~/forum-mso-en4-802501.xlsx

move getTables().applyAutoFilters(), which wants to query tab 1 while
tab 1 is still getting imported, until after the threaded import has
completed.

This call was moved before in:

commit edd51b8
Date:   Thu Aug 15 16:23:46 2013 +0100

    fix for bnc#834705 missing drop downs for autofilter

==================
WARNING: ThreadSanitizer: data race (pid=3791886)
  Read of size 8 at 0x7b5000040f20 by thread T7 (mutexes: write M0, write M1):
    #0 __gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>::__normal_iterator(unsigned long const* const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_iterator.h:1073:20 (libsclo.so+0x3d31c4) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::cend() const /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:960:16 (libsclo.so+0x3d31c4)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::cbegin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3771:34 (libsclo.so+0x3d31c4)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::begin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3753:12 (libsclo.so+0x3d31c4)
    #4 ScColumn::InitBlockPosition(sc::ColumnBlockConstPosition&) const core/sc/source/core/data/column3.cxx:1135:35 (libsclo.so+0x3d31c4)
    #5 ScTable::GetDataArea(short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/table1.cxx:908:19 (libsclo.so+0x637b39) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #6 ScDocument::GetDataArea(short, short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/document.cxx:1104:23 (libsclo.so+0x49b696) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 ScDBData::ExtendDataArea(ScDocument const&) core/sc/source/core/tool/dbdata.cxx:654:10 (libsclo.so+0x741e77) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocument::GetFilterEntries(short, int, short, ScFilterEntries&) core/sc/source/core/data/documen3.cxx:1577:14 (libsclo.so+0x46e7a6) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #9 (anonymous namespace)::fillQueryParam(ScQueryParam&, ScDocument*, com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1164:27 (libsclo.so+0xf7dd72) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #10 ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1380:5 (libsclo.so+0xf7dd72)
    #11 non-virtual thunk to ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx (libsclo.so+0xf7e2c2) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #12 oox::xls::AutoFilter::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:803:22 (libscfiltlo.so+0x3cca2c) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #13 oox::xls::AutoFilterBuffer::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:950:22 (libscfiltlo.so+0x3cdc0b) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #14 oox::xls::Table::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:143:23 (libscfiltlo.so+0x4b9268) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #15 void std::__invoke_impl<void, void (oox::xls::Table::*&)(), oox::xls::Table&>(std::__invoke_memfun_ref, void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:67:14 (libscfiltlo.so+0x4b9d96) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #16 std::__invoke_result<void (oox::xls::Table::*&)(), oox::xls::Table&>::type std::__invoke<void (oox::xls::Table::*&)(), oox::xls::Table&>(void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14 (libscfiltlo.so+0x4b9d96)
    #17 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::__call<void, oox::xls::Table&, 0ul>(std::tuple<oox::xls::Table&>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:495:11 (libscfiltlo.so+0x4b9d96)
    #18 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::operator()<oox::xls::Table&, void>(oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:580:17 (libscfiltlo.so+0x4b9d96)
    #19 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>::operator()(std::pair<int const, std::shared_ptr<oox::xls::Table>> const&) core/include/oox/helper/refmap.hxx:122:89 (libscfiltlo.so+0x4b9d96)
    #20 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>> std::for_each<std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>>(std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_algo.h:3787:2 (libscfiltlo.so+0x4b9d96)
    #21 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEach<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>(std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()> const&) const core/include/oox/helper/refmap.hxx:71:29 (libscfiltlo.so+0x4b9d96)
    #22 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEachMem<void (oox::xls::Table::*)()>(void (oox::xls::Table::*)()) const core/include/oox/helper/refmap.hxx:79:29 (libscfiltlo.so+0x4b9d96)
    #23 oox::xls::TableBuffer::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:179:16 (libscfiltlo.so+0x4b9d96)
    #24 oox::xls::WorksheetGlobals::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:943:17 (libscfiltlo.so+0x4ee58e) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #25 oox::xls::WorksheetHelper::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:1625:17 (libscfiltlo.so+0x4f2cff) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #26 oox::xls::WorksheetFragment::finalizeImport() core/sc/source/filter/oox/worksheetfragment.cxx:632:5 (libscfiltlo.so+0x4e91cc) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #27 oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx:53:5 (libooxlo.so+0x1c20d9) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #28 non-virtual thunk to oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx (libooxlo.so+0x1c20d9)
    #29 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:910:36 (libexpwraplo.so+0x2a06a) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #30 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #31 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #32 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #33 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #34 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #35 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #36 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #37 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #38 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #39 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #40 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #41 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

  Previous write of size 8 at 0x7b5000040f20 by thread T6 (mutexes: write M2):
    #0 std::vector<unsigned long, std::allocator<unsigned long>>::_M_fill_insert(__gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:556:29 (libsclo.so+0x2f6766) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::insert(__gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1435:2 (libsclo.so+0x2ffd3a) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::blocks_type::insert(unsigned long, unsigned long) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:99:15 (libsclo.so+0x2ffd3a)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_new_block_to_middle(unsigned long, unsigned long, unsigned long, bool) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:4326:19 (libsclo.so+0x2ffd3a)
    #4 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_middle_of_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3999:19 (libsclo.so+0x3259fe) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #5 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_empty_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3313:12 (libsclo.so+0x3259fe)
    #6 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_impl<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:1260:16 (libsclo.so+0x32492f) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set<double>(mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> const&, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:754:20 (libsclo.so+0x4cc138) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocumentImport::setNumericCell(ScAddress const&, double) core/sc/source/core/data/documentimport.cxx:259:35 (libsclo.so+0x4cc138)
    #9 oox::xls::SheetDataBuffer::setValueCell(oox::xls::CellModel const&, double) core/sc/source/filter/oox/sheetdatabuffer.cxx:107:20 (libscfiltlo.so+0x4833c0) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #10 oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx:185:25 (libscfiltlo.so+0x48fed2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #11 non-virtual thunk to oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx (libscfiltlo.so+0x48fff9) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #12 oox::core::ContextHandler2Helper::implEndElement(int) core/oox/source/core/contexthandler2.cxx:125:9 (libooxlo.so+0x1ac82b) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #13 oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx:220:5 (libooxlo.so+0x1ac82b)
    #14 non-virtual thunk to oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx (libooxlo.so+0x1ac82b)
    #15 (anonymous namespace)::Entity::endElement() core/sax/source/fastparser/fastparser.cxx:515:27 (libexpwraplo.so+0x3042f) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #16 sax_fastparser::FastSaxParserImpl::consume((anonymous namespace)::EventList&) core/sax/source/fastparser/fastparser.cxx:1029:25 (libexpwraplo.so+0x29d37) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #17 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:869:22 (libexpwraplo.so+0x29d37)
    #18 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #19 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #20 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #21 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #22 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #23 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #24 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #25 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #26 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #27 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #28 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #29 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

Change-Id: I7542432749fded8ab5e35f79cb221ad712f7802d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146430
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
tdf-gerrit pushed a commit that referenced this pull request Feb 1, 2023
An ASan UITest_writer_tests7
UITEST_TEST_NAME=tdf135938.tdf135938.test_tdf135938_cross_reference_update
occasionally failed for me with

> ==1994973==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f00014d718 at pc 0x7f95f4946ffa bp 0x7f95907fd720 sp 0x7f95907fd718
> READ of size 8 at 0x60f00014d718 thread T33
>  #0 in std::__cxx1998::vector<std::unique_ptr<SvLBoxItem, std::default_delete<SvLBoxItem>>, std::allocator<std::unique_ptr<SvLBoxItem, std::default_delete<SvLBoxItem>>>>::size() const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:988:40
>  #1 in SvTreeListEntry::ItemCount() const at vcl/source/treelist/treelistentry.cxx:110:20
>  #2 in SvTabListBox::GetEntryText(SvTreeListEntry const*, unsigned short) at vcl/source/treelist/svtabbx.cxx:289:37
>  #3 in SvTabListBox::GetEntryText(SvTreeListEntry*) const at vcl/source/treelist/svtabbx.cxx:280:12
>  #4 in TreeListEntryUIObject::get_state() at vcl/source/treelist/uiobject.cxx:119:32
>  #5 in UIObjectUnoObj::getState() at vcl/source/uitest/uno/uiobject_uno.cxx:164:29
>  #6 in non-virtual thunk to UIObjectUnoObj::getState() at vcl/source/uitest/uno/uiobject_uno.cxx
>  #7 in 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:77:5
>  #8 in 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:233:13
>  #9 in unoInterfaceProxyDispatch at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
>  #10 in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny>>*) const at binaryurp/source/incomingrequest.cxx:236:13
>  #11 in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:79:26
>  #12 in request at binaryurp/source/reader.cxx:86:9
>  #13 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100:17
>  #14 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:165:31
>
> 0x60f00014d718 is located 120 bytes inside of 168-byte region [0x60f00014d6a0,0x60f00014d748)
> freed by thread T0 here:
>  #0 in operator delete(void*, unsigned long) at ~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
>  #1 in SvTreeListEntry::~SvTreeListEntry() at vcl/source/treelist/treelistentry.cxx:62:1
>  #2 in std::default_delete<SvTreeListEntry>::operator()(SvTreeListEntry*) const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/unique_ptr.h:102:2
>  #3 in std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>::~unique_ptr() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/unique_ptr.h:407:4
>  #4 in void std::destroy_at<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:88:15
>  #5 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:149:7
>  #6 in void std::_Destroy_aux<false>::__destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:163:6
>  #7 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:195:7
>  #8 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/alloc_traits.h:947:7
>  #9 in std::__cxx1998::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::_M_erase_at_end(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:1932:6
>  #10 in std::__cxx1998::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:1601:9
>  #11 in std::__debug::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/debug/vector:729:9
>  #12 in SvTreeListEntry::ClearChildren() at vcl/source/treelist/treelistentry.cxx:28:16
>  #13 in SvTreeList::Clear() at vcl/source/treelist/treelist.cxx:123:16
>  #14 in SvTreeListBox::Clear() at vcl/source/treelist/treelistbox.cxx:422:17
>  #15 in SalInstanceTreeView::clear() at vcl/source/app/salvtables.cxx:4240:18
>  #16 in SwFieldRefPage::Reset(SfxItemSet const*) at sw/source/ui/fldui/fldref.cxx:175:16
>  #17 in SwFieldPage::EditNewField(bool) at sw/source/ui/fldui/fldpage.cxx:111:5
>  #18 in SwFieldDlg::ReInitTabPage(std::basic_string_view<char, std::char_traits<char>>, bool) at sw/source/ui/fldui/fldtdlg.cxx:218:16
>  #19 in SwFieldDlg::Activate() at sw/source/ui/fldui/fldtdlg.cxx:239:9
>  #20 in SwChildWinWrapper::UpdateHdl(Timer*) at sw/source/uibase/fldui/fldwrap.cxx:42:26
>  #21 in SwChildWinWrapper::LinkStubUpdateHdl(void*, Timer*) at sw/source/uibase/fldui/fldwrap.cxx:39:1
>  #22 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45
>  #23 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21
>  #24 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:481:20
>  #25 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13
>  #26 in SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:161:53
>  #27 in SvpSalInstance::ImplYield(bool, bool) at vcl/headless/svpinst.cxx:399:17
>  #28 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:471:21
>  #29 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:475:48
>  #30 in Application::Yield() at vcl/source/app/svapp.cxx:559:5
>  #31 in Application::Execute() at vcl/source/app/svapp.cxx:453:13
>  #32 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1604:13

causing

> ERROR: test_tdf135938_cross_reference_update (tdf135938.tdf135938)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "uitest/uitest/test.py", line 125, in execute_dialog_through_command
>     yield xDialog
>   File "uitest/uitest/test.py", line 140, in execute_modeless_dialog_through_command
>     yield xDialog
>   File "sw/qa/uitest/writer_tests7/tdf135938.py", line 40, in test_tdf135938_cross_reference_update
>     self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"])
>   File "uitest/uitest/uihelper/common.py", line 13, in get_state_as_dict
>     return convert_property_values_to_dict(ui_object.getState())
> uitest.uihelper.common.com.sun.star.lang.DisposedException: Binary URP bridge disposed during call at binaryurp/source/bridge.cxx:613

The issue apparently is that TreeListEntryUIObject UNO objects, introduced in
71f562f "uitest: support tree lists", reference
SvTreeListEntry instances by pointers that can apparently go stale while those
UNO objects are still alive.  I'm not sure there would be an easy fix for this,
short of making those SvTreeListEntry instances ref-counted, or ripping out
UITest support for those TreeListEntryUIObjects again.

However, that underlying issue would presumably not be of practical concern if
the test_tdf135938_cross_reference_update Python code would have waited for
processEventsToIdle between its

>                 xInsert.executeAction("CLICK", tuple())

and the following block

>                 self.assertEqual("2", get_state_as_dict(xSelect)["Children"])
>                 self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"])
>                 self.assertEqual("DEF", get_state_as_dict(xSelect.getChild(1))["Text"])

That way, there should be no more opportunity for the pointers in the passed-out
TreeListEntryUIObjects to become stale while the Python code accesses them.

And in Python UITest code, having to follow a call to executeAction by a call to
processEventsToIdle appears to be a common and recurring requirement, just look
at the most recent af1ca68 "another stab at
making this test reliable", d183dae
"tdf#153161: (Ab)use a call to XTextRange::getString to flush edits",
3cc6b87 "make an effort to fix the
UITest_inputLine intermittent failure", f466854
"tdf#150443 sw: fix crash of rejecting table row deletion".

So make executeAction always call ProcessEventsToIdle, to simplify this and
hopefully make UITests more robust.  (Removing any now-redundant calls to
processEventsToIdle, following calls to executeAction, from Python test code is
left as follow-up clean up for now.)

(I /think/ that the implementation of UIObjectUnoObj::executeAction could be
simplified now, as waiting for Scheduler::ProcessEventsToIdle() should already
make sure that aIdle has been processed, removing the need for the Notifier.
But lets leave that as a follow-up TODO for now.)

Change-Id: I41a5d51515dedaae44fb810b0ad3b0264c90abf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146434
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 51a2e1a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146404
tdf-gerrit pushed a commit that referenced this pull request Feb 2, 2023
An ASan UITest_writer_tests7
UITEST_TEST_NAME=tdf135938.tdf135938.test_tdf135938_cross_reference_update
occasionally failed for me with

> ==1994973==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f00014d718 at pc 0x7f95f4946ffa bp 0x7f95907fd720 sp 0x7f95907fd718
> READ of size 8 at 0x60f00014d718 thread T33
>  #0 in std::__cxx1998::vector<std::unique_ptr<SvLBoxItem, std::default_delete<SvLBoxItem>>, std::allocator<std::unique_ptr<SvLBoxItem, std::default_delete<SvLBoxItem>>>>::size() const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:988:40
>  #1 in SvTreeListEntry::ItemCount() const at vcl/source/treelist/treelistentry.cxx:110:20
>  #2 in SvTabListBox::GetEntryText(SvTreeListEntry const*, unsigned short) at vcl/source/treelist/svtabbx.cxx:289:37
>  #3 in SvTabListBox::GetEntryText(SvTreeListEntry*) const at vcl/source/treelist/svtabbx.cxx:280:12
>  #4 in TreeListEntryUIObject::get_state() at vcl/source/treelist/uiobject.cxx:119:32
>  #5 in UIObjectUnoObj::getState() at vcl/source/uitest/uno/uiobject_uno.cxx:164:29
>  #6 in non-virtual thunk to UIObjectUnoObj::getState() at vcl/source/uitest/uno/uiobject_uno.cxx
>  #7 in 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:77:5
>  #8 in 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:233:13
>  #9 in unoInterfaceProxyDispatch at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
>  #10 in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny>>*) const at binaryurp/source/incomingrequest.cxx:236:13
>  #11 in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:79:26
>  #12 in request at binaryurp/source/reader.cxx:86:9
>  #13 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100:17
>  #14 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:165:31
>
> 0x60f00014d718 is located 120 bytes inside of 168-byte region [0x60f00014d6a0,0x60f00014d748)
> freed by thread T0 here:
>  #0 in operator delete(void*, unsigned long) at ~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
>  #1 in SvTreeListEntry::~SvTreeListEntry() at vcl/source/treelist/treelistentry.cxx:62:1
>  #2 in std::default_delete<SvTreeListEntry>::operator()(SvTreeListEntry*) const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/unique_ptr.h:102:2
>  #3 in std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>::~unique_ptr() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/unique_ptr.h:407:4
>  #4 in void std::destroy_at<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:88:15
>  #5 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:149:7
>  #6 in void std::_Destroy_aux<false>::__destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:163:6
>  #7 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_construct.h:195:7
>  #8 in void std::_Destroy<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/alloc_traits.h:947:7
>  #9 in std::__cxx1998::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::_M_erase_at_end(std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:1932:6
>  #10 in std::__cxx1998::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/bits/stl_vector.h:1601:9
>  #11 in std::__debug::vector<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>, std::allocator<std::unique_ptr<SvTreeListEntry, std::default_delete<SvTreeListEntry>>>>::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/13.0.0/../../../../include/c++/13.0.0/debug/vector:729:9
>  #12 in SvTreeListEntry::ClearChildren() at vcl/source/treelist/treelistentry.cxx:28:16
>  #13 in SvTreeList::Clear() at vcl/source/treelist/treelist.cxx:123:16
>  #14 in SvTreeListBox::Clear() at vcl/source/treelist/treelistbox.cxx:422:17
>  #15 in SalInstanceTreeView::clear() at vcl/source/app/salvtables.cxx:4240:18
>  #16 in SwFieldRefPage::Reset(SfxItemSet const*) at sw/source/ui/fldui/fldref.cxx:175:16
>  #17 in SwFieldPage::EditNewField(bool) at sw/source/ui/fldui/fldpage.cxx:111:5
>  #18 in SwFieldDlg::ReInitTabPage(std::basic_string_view<char, std::char_traits<char>>, bool) at sw/source/ui/fldui/fldtdlg.cxx:218:16
>  #19 in SwFieldDlg::Activate() at sw/source/ui/fldui/fldtdlg.cxx:239:9
>  #20 in SwChildWinWrapper::UpdateHdl(Timer*) at sw/source/uibase/fldui/fldwrap.cxx:42:26
>  #21 in SwChildWinWrapper::LinkStubUpdateHdl(void*, Timer*) at sw/source/uibase/fldui/fldwrap.cxx:39:1
>  #22 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45
>  #23 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21
>  #24 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:481:20
>  #25 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13
>  #26 in SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:161:53
>  #27 in SvpSalInstance::ImplYield(bool, bool) at vcl/headless/svpinst.cxx:399:17
>  #28 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:471:21
>  #29 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:475:48
>  #30 in Application::Yield() at vcl/source/app/svapp.cxx:559:5
>  #31 in Application::Execute() at vcl/source/app/svapp.cxx:453:13
>  #32 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1604:13

causing

> ERROR: test_tdf135938_cross_reference_update (tdf135938.tdf135938)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "uitest/uitest/test.py", line 125, in execute_dialog_through_command
>     yield xDialog
>   File "uitest/uitest/test.py", line 140, in execute_modeless_dialog_through_command
>     yield xDialog
>   File "sw/qa/uitest/writer_tests7/tdf135938.py", line 40, in test_tdf135938_cross_reference_update
>     self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"])
>   File "uitest/uitest/uihelper/common.py", line 13, in get_state_as_dict
>     return convert_property_values_to_dict(ui_object.getState())
> uitest.uihelper.common.com.sun.star.lang.DisposedException: Binary URP bridge disposed during call at binaryurp/source/bridge.cxx:613

The issue apparently is that TreeListEntryUIObject UNO objects, introduced in
71f562f "uitest: support tree lists", reference
SvTreeListEntry instances by pointers that can apparently go stale while those
UNO objects are still alive.  I'm not sure there would be an easy fix for this,
short of making those SvTreeListEntry instances ref-counted, or ripping out
UITest support for those TreeListEntryUIObjects again.

However, that underlying issue would presumably not be of practical concern if
the test_tdf135938_cross_reference_update Python code would have waited for
processEventsToIdle between its

>                 xInsert.executeAction("CLICK", tuple())

and the following block

>                 self.assertEqual("2", get_state_as_dict(xSelect)["Children"])
>                 self.assertEqual("ABC", get_state_as_dict(xSelect.getChild(0))["Text"])
>                 self.assertEqual("DEF", get_state_as_dict(xSelect.getChild(1))["Text"])

That way, there should be no more opportunity for the pointers in the passed-out
TreeListEntryUIObjects to become stale while the Python code accesses them.

And in Python UITest code, having to follow a call to executeAction by a call to
processEventsToIdle appears to be a common and recurring requirement, just look
at the most recent af1ca68 "another stab at
making this test reliable", d183dae
"tdf#153161: (Ab)use a call to XTextRange::getString to flush edits",
3cc6b87 "make an effort to fix the
UITest_inputLine intermittent failure", f466854
"tdf#150443 sw: fix crash of rejecting table row deletion".

So make executeAction always call ProcessEventsToIdle, to simplify this and
hopefully make UITests more robust.  (Removing any now-redundant calls to
processEventsToIdle, following calls to executeAction, from Python test code is
left as follow-up clean up for now.)

(I /think/ that the implementation of UIObjectUnoObj::executeAction could be
simplified now, as waiting for Scheduler::ProcessEventsToIdle() should already
make sure that aIdle has been processed, removing the need for the Notifier.
But lets leave that as a follow-up TODO for now.)

Change-Id: I41a5d51515dedaae44fb810b0ad3b0264c90abf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146434
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 51a2e1a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146404
tdf-gerrit pushed a commit that referenced this pull request Feb 9, 2023
sporadically reproducible with tsan and
./instdir/program/soffice.bin --headless --convert-to pdf ~/forum-mso-en4-802501.xlsx

move getTables().applyAutoFilters(), which wants to query tab 1 while
tab 1 is still getting imported, until after the threaded import has
completed.

This call was moved before in:

commit edd51b8
Date:   Thu Aug 15 16:23:46 2013 +0100

    fix for bnc#834705 missing drop downs for autofilter

==================
WARNING: ThreadSanitizer: data race (pid=3791886)
  Read of size 8 at 0x7b5000040f20 by thread T7 (mutexes: write M0, write M1):
    #0 __gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>::__normal_iterator(unsigned long const* const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_iterator.h:1073:20 (libsclo.so+0x3d31c4) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::cend() const /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:960:16 (libsclo.so+0x3d31c4)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::cbegin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3771:34 (libsclo.so+0x3d31c4)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::begin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3753:12 (libsclo.so+0x3d31c4)
    #4 ScColumn::InitBlockPosition(sc::ColumnBlockConstPosition&) const core/sc/source/core/data/column3.cxx:1135:35 (libsclo.so+0x3d31c4)
    #5 ScTable::GetDataArea(short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/table1.cxx:908:19 (libsclo.so+0x637b39) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #6 ScDocument::GetDataArea(short, short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/document.cxx:1104:23 (libsclo.so+0x49b696) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 ScDBData::ExtendDataArea(ScDocument const&) core/sc/source/core/tool/dbdata.cxx:654:10 (libsclo.so+0x741e77) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocument::GetFilterEntries(short, int, short, ScFilterEntries&) core/sc/source/core/data/documen3.cxx:1577:14 (libsclo.so+0x46e7a6) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #9 (anonymous namespace)::fillQueryParam(ScQueryParam&, ScDocument*, com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1164:27 (libsclo.so+0xf7dd72) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #10 ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1380:5 (libsclo.so+0xf7dd72)
    #11 non-virtual thunk to ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx (libsclo.so+0xf7e2c2) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #12 oox::xls::AutoFilter::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:803:22 (libscfiltlo.so+0x3cca2c) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #13 oox::xls::AutoFilterBuffer::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:950:22 (libscfiltlo.so+0x3cdc0b) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #14 oox::xls::Table::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:143:23 (libscfiltlo.so+0x4b9268) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #15 void std::__invoke_impl<void, void (oox::xls::Table::*&)(), oox::xls::Table&>(std::__invoke_memfun_ref, void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:67:14 (libscfiltlo.so+0x4b9d96) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #16 std::__invoke_result<void (oox::xls::Table::*&)(), oox::xls::Table&>::type std::__invoke<void (oox::xls::Table::*&)(), oox::xls::Table&>(void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14 (libscfiltlo.so+0x4b9d96)
    #17 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::__call<void, oox::xls::Table&, 0ul>(std::tuple<oox::xls::Table&>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:495:11 (libscfiltlo.so+0x4b9d96)
    #18 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::operator()<oox::xls::Table&, void>(oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:580:17 (libscfiltlo.so+0x4b9d96)
    #19 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>::operator()(std::pair<int const, std::shared_ptr<oox::xls::Table>> const&) core/include/oox/helper/refmap.hxx:122:89 (libscfiltlo.so+0x4b9d96)
    #20 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>> std::for_each<std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>>(std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_algo.h:3787:2 (libscfiltlo.so+0x4b9d96)
    #21 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEach<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>(std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()> const&) const core/include/oox/helper/refmap.hxx:71:29 (libscfiltlo.so+0x4b9d96)
    #22 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEachMem<void (oox::xls::Table::*)()>(void (oox::xls::Table::*)()) const core/include/oox/helper/refmap.hxx:79:29 (libscfiltlo.so+0x4b9d96)
    #23 oox::xls::TableBuffer::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:179:16 (libscfiltlo.so+0x4b9d96)
    #24 oox::xls::WorksheetGlobals::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:943:17 (libscfiltlo.so+0x4ee58e) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #25 oox::xls::WorksheetHelper::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:1625:17 (libscfiltlo.so+0x4f2cff) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #26 oox::xls::WorksheetFragment::finalizeImport() core/sc/source/filter/oox/worksheetfragment.cxx:632:5 (libscfiltlo.so+0x4e91cc) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #27 oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx:53:5 (libooxlo.so+0x1c20d9) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #28 non-virtual thunk to oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx (libooxlo.so+0x1c20d9)
    #29 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:910:36 (libexpwraplo.so+0x2a06a) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #30 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #31 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #32 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #33 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #34 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #35 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #36 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #37 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #38 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #39 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #40 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #41 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

  Previous write of size 8 at 0x7b5000040f20 by thread T6 (mutexes: write M2):
    #0 std::vector<unsigned long, std::allocator<unsigned long>>::_M_fill_insert(__gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:556:29 (libsclo.so+0x2f6766) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::insert(__gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1435:2 (libsclo.so+0x2ffd3a) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::blocks_type::insert(unsigned long, unsigned long) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:99:15 (libsclo.so+0x2ffd3a)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_new_block_to_middle(unsigned long, unsigned long, unsigned long, bool) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:4326:19 (libsclo.so+0x2ffd3a)
    #4 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_middle_of_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3999:19 (libsclo.so+0x3259fe) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #5 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_empty_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3313:12 (libsclo.so+0x3259fe)
    #6 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_impl<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:1260:16 (libsclo.so+0x32492f) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set<double>(mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> const&, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:754:20 (libsclo.so+0x4cc138) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocumentImport::setNumericCell(ScAddress const&, double) core/sc/source/core/data/documentimport.cxx:259:35 (libsclo.so+0x4cc138)
    #9 oox::xls::SheetDataBuffer::setValueCell(oox::xls::CellModel const&, double) core/sc/source/filter/oox/sheetdatabuffer.cxx:107:20 (libscfiltlo.so+0x4833c0) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #10 oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx:185:25 (libscfiltlo.so+0x48fed2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #11 non-virtual thunk to oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx (libscfiltlo.so+0x48fff9) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #12 oox::core::ContextHandler2Helper::implEndElement(int) core/oox/source/core/contexthandler2.cxx:125:9 (libooxlo.so+0x1ac82b) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #13 oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx:220:5 (libooxlo.so+0x1ac82b)
    #14 non-virtual thunk to oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx (libooxlo.so+0x1ac82b)
    #15 (anonymous namespace)::Entity::endElement() core/sax/source/fastparser/fastparser.cxx:515:27 (libexpwraplo.so+0x3042f) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #16 sax_fastparser::FastSaxParserImpl::consume((anonymous namespace)::EventList&) core/sax/source/fastparser/fastparser.cxx:1029:25 (libexpwraplo.so+0x29d37) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #17 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:869:22 (libexpwraplo.so+0x29d37)
    #18 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #19 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #20 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #21 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #22 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #23 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #24 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #25 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #26 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #27 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #28 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #29 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

Change-Id: I7542432749fded8ab5e35f79cb221ad712f7802d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146430
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 6652768)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146531
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request Feb 12, 2023
sporadically reproducible with tsan and
./instdir/program/soffice.bin --headless --convert-to pdf ~/forum-mso-en4-802501.xlsx

move getTables().applyAutoFilters(), which wants to query tab 1 while
tab 1 is still getting imported, until after the threaded import has
completed.

This call was moved before in:

commit edd51b8
Date:   Thu Aug 15 16:23:46 2013 +0100

    fix for bnc#834705 missing drop downs for autofilter

==================
WARNING: ThreadSanitizer: data race (pid=3791886)
  Read of size 8 at 0x7b5000040f20 by thread T7 (mutexes: write M0, write M1):
    #0 __gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>::__normal_iterator(unsigned long const* const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_iterator.h:1073:20 (libsclo.so+0x3d31c4) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::cend() const /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:960:16 (libsclo.so+0x3d31c4)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::cbegin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3771:34 (libsclo.so+0x3d31c4)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::begin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3753:12 (libsclo.so+0x3d31c4)
    #4 ScColumn::InitBlockPosition(sc::ColumnBlockConstPosition&) const core/sc/source/core/data/column3.cxx:1135:35 (libsclo.so+0x3d31c4)
    #5 ScTable::GetDataArea(short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/table1.cxx:908:19 (libsclo.so+0x637b39) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #6 ScDocument::GetDataArea(short, short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/document.cxx:1104:23 (libsclo.so+0x49b696) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 ScDBData::ExtendDataArea(ScDocument const&) core/sc/source/core/tool/dbdata.cxx:654:10 (libsclo.so+0x741e77) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocument::GetFilterEntries(short, int, short, ScFilterEntries&) core/sc/source/core/data/documen3.cxx:1577:14 (libsclo.so+0x46e7a6) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #9 (anonymous namespace)::fillQueryParam(ScQueryParam&, ScDocument*, com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1164:27 (libsclo.so+0xf7dd72) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #10 ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1380:5 (libsclo.so+0xf7dd72)
    #11 non-virtual thunk to ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx (libsclo.so+0xf7e2c2) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #12 oox::xls::AutoFilter::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:803:22 (libscfiltlo.so+0x3cca2c) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #13 oox::xls::AutoFilterBuffer::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:950:22 (libscfiltlo.so+0x3cdc0b) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #14 oox::xls::Table::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:143:23 (libscfiltlo.so+0x4b9268) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #15 void std::__invoke_impl<void, void (oox::xls::Table::*&)(), oox::xls::Table&>(std::__invoke_memfun_ref, void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:67:14 (libscfiltlo.so+0x4b9d96) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #16 std::__invoke_result<void (oox::xls::Table::*&)(), oox::xls::Table&>::type std::__invoke<void (oox::xls::Table::*&)(), oox::xls::Table&>(void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14 (libscfiltlo.so+0x4b9d96)
    #17 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::__call<void, oox::xls::Table&, 0ul>(std::tuple<oox::xls::Table&>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:495:11 (libscfiltlo.so+0x4b9d96)
    #18 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::operator()<oox::xls::Table&, void>(oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:580:17 (libscfiltlo.so+0x4b9d96)
    #19 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>::operator()(std::pair<int const, std::shared_ptr<oox::xls::Table>> const&) core/include/oox/helper/refmap.hxx:122:89 (libscfiltlo.so+0x4b9d96)
    #20 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>> std::for_each<std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>>(std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_algo.h:3787:2 (libscfiltlo.so+0x4b9d96)
    #21 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEach<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>(std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()> const&) const core/include/oox/helper/refmap.hxx:71:29 (libscfiltlo.so+0x4b9d96)
    #22 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEachMem<void (oox::xls::Table::*)()>(void (oox::xls::Table::*)()) const core/include/oox/helper/refmap.hxx:79:29 (libscfiltlo.so+0x4b9d96)
    #23 oox::xls::TableBuffer::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:179:16 (libscfiltlo.so+0x4b9d96)
    #24 oox::xls::WorksheetGlobals::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:943:17 (libscfiltlo.so+0x4ee58e) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #25 oox::xls::WorksheetHelper::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:1625:17 (libscfiltlo.so+0x4f2cff) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #26 oox::xls::WorksheetFragment::finalizeImport() core/sc/source/filter/oox/worksheetfragment.cxx:632:5 (libscfiltlo.so+0x4e91cc) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #27 oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx:53:5 (libooxlo.so+0x1c20d9) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #28 non-virtual thunk to oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx (libooxlo.so+0x1c20d9)
    #29 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:910:36 (libexpwraplo.so+0x2a06a) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #30 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #31 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #32 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #33 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #34 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #35 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #36 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #37 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #38 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #39 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #40 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #41 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

  Previous write of size 8 at 0x7b5000040f20 by thread T6 (mutexes: write M2):
    #0 std::vector<unsigned long, std::allocator<unsigned long>>::_M_fill_insert(__gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:556:29 (libsclo.so+0x2f6766) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::insert(__gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1435:2 (libsclo.so+0x2ffd3a) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::blocks_type::insert(unsigned long, unsigned long) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:99:15 (libsclo.so+0x2ffd3a)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_new_block_to_middle(unsigned long, unsigned long, unsigned long, bool) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:4326:19 (libsclo.so+0x2ffd3a)
    #4 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_middle_of_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3999:19 (libsclo.so+0x3259fe) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #5 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_empty_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3313:12 (libsclo.so+0x3259fe)
    #6 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_impl<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:1260:16 (libsclo.so+0x32492f) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set<double>(mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> const&, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:754:20 (libsclo.so+0x4cc138) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocumentImport::setNumericCell(ScAddress const&, double) core/sc/source/core/data/documentimport.cxx:259:35 (libsclo.so+0x4cc138)
    #9 oox::xls::SheetDataBuffer::setValueCell(oox::xls::CellModel const&, double) core/sc/source/filter/oox/sheetdatabuffer.cxx:107:20 (libscfiltlo.so+0x4833c0) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #10 oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx:185:25 (libscfiltlo.so+0x48fed2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #11 non-virtual thunk to oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx (libscfiltlo.so+0x48fff9) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #12 oox::core::ContextHandler2Helper::implEndElement(int) core/oox/source/core/contexthandler2.cxx:125:9 (libooxlo.so+0x1ac82b) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #13 oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx:220:5 (libooxlo.so+0x1ac82b)
    #14 non-virtual thunk to oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx (libooxlo.so+0x1ac82b)
    #15 (anonymous namespace)::Entity::endElement() core/sax/source/fastparser/fastparser.cxx:515:27 (libexpwraplo.so+0x3042f) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #16 sax_fastparser::FastSaxParserImpl::consume((anonymous namespace)::EventList&) core/sax/source/fastparser/fastparser.cxx:1029:25 (libexpwraplo.so+0x29d37) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #17 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:869:22 (libexpwraplo.so+0x29d37)
    #18 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #19 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #20 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #21 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #22 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #23 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #24 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #25 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #26 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #27 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #28 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #29 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

Change-Id: I7542432749fded8ab5e35f79cb221ad712f7802d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146430
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 6652768)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146531
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request Feb 22, 2023
sporadically reproducible with tsan and
./instdir/program/soffice.bin --headless --convert-to pdf ~/forum-mso-en4-802501.xlsx

move getTables().applyAutoFilters(), which wants to query tab 1 while
tab 1 is still getting imported, until after the threaded import has
completed.

This call was moved before in:

commit edd51b8
Date:   Thu Aug 15 16:23:46 2013 +0100

    fix for bnc#834705 missing drop downs for autofilter

==================
WARNING: ThreadSanitizer: data race (pid=3791886)
  Read of size 8 at 0x7b5000040f20 by thread T7 (mutexes: write M0, write M1):
    #0 __gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>::__normal_iterator(unsigned long const* const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_iterator.h:1073:20 (libsclo.so+0x3d31c4) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::cend() const /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:960:16 (libsclo.so+0x3d31c4)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::cbegin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3771:34 (libsclo.so+0x3d31c4)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::begin() const core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3753:12 (libsclo.so+0x3d31c4)
    #4 ScColumn::InitBlockPosition(sc::ColumnBlockConstPosition&) const core/sc/source/core/data/column3.cxx:1135:35 (libsclo.so+0x3d31c4)
    #5 ScTable::GetDataArea(short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/table1.cxx:908:19 (libsclo.so+0x637b39) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #6 ScDocument::GetDataArea(short, short&, int&, short&, int&, bool, bool) const core/sc/source/core/data/document.cxx:1104:23 (libsclo.so+0x49b696) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 ScDBData::ExtendDataArea(ScDocument const&) core/sc/source/core/tool/dbdata.cxx:654:10 (libsclo.so+0x741e77) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocument::GetFilterEntries(short, int, short, ScFilterEntries&) core/sc/source/core/data/documen3.cxx:1577:14 (libsclo.so+0x46e7a6) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #9 (anonymous namespace)::fillQueryParam(ScQueryParam&, ScDocument*, com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1164:27 (libsclo.so+0xf7dd72) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #10 ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx:1380:5 (libsclo.so+0xf7dd72)
    #11 non-virtual thunk to ScFilterDescriptorBase::setFilterFields3(com::sun::star::uno::Sequence<com::sun::star::sheet::TableFilterField3> const&) core/sc/source/ui/unoobj/datauno.cxx (libsclo.so+0xf7e2c2) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #12 oox::xls::AutoFilter::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:803:22 (libscfiltlo.so+0x3cca2c) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #13 oox::xls::AutoFilterBuffer::finalizeImport(com::sun::star::uno::Reference<com::sun::star::sheet::XDatabaseRange> const&, short) core/sc/source/filter/oox/autofilterbuffer.cxx:950:22 (libscfiltlo.so+0x3cdc0b) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #14 oox::xls::Table::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:143:23 (libscfiltlo.so+0x4b9268) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #15 void std::__invoke_impl<void, void (oox::xls::Table::*&)(), oox::xls::Table&>(std::__invoke_memfun_ref, void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:67:14 (libscfiltlo.so+0x4b9d96) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #16 std::__invoke_result<void (oox::xls::Table::*&)(), oox::xls::Table&>::type std::__invoke<void (oox::xls::Table::*&)(), oox::xls::Table&>(void (oox::xls::Table::*&)(), oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14 (libscfiltlo.so+0x4b9d96)
    #17 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::__call<void, oox::xls::Table&, 0ul>(std::tuple<oox::xls::Table&>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:495:11 (libscfiltlo.so+0x4b9d96)
    #18 void std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>::operator()<oox::xls::Table&, void>(oox::xls::Table&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:580:17 (libscfiltlo.so+0x4b9d96)
    #19 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>::operator()(std::pair<int const, std::shared_ptr<oox::xls::Table>> const&) core/include/oox/helper/refmap.hxx:122:89 (libscfiltlo.so+0x4b9d96)
    #20 oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>> std::for_each<std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>>(std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, std::_Rb_tree_const_iterator<std::pair<int const, std::shared_ptr<oox::xls::Table>>>, oox::RefMap<int, oox::xls::Table, std::less<int>>::ForEachFunctor<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_algo.h:3787:2 (libscfiltlo.so+0x4b9d96)
    #21 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEach<std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()>>(std::_Bind<void (oox::xls::Table::* (std::_Placeholder<1>))()> const&) const core/include/oox/helper/refmap.hxx:71:29 (libscfiltlo.so+0x4b9d96)
    #22 void oox::RefMap<int, oox::xls::Table, std::less<int>>::forEachMem<void (oox::xls::Table::*)()>(void (oox::xls::Table::*)()) const core/include/oox/helper/refmap.hxx:79:29 (libscfiltlo.so+0x4b9d96)
    #23 oox::xls::TableBuffer::applyAutoFilters() core/sc/source/filter/oox/tablebuffer.cxx:179:16 (libscfiltlo.so+0x4b9d96)
    #24 oox::xls::WorksheetGlobals::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:943:17 (libscfiltlo.so+0x4ee58e) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #25 oox::xls::WorksheetHelper::finalizeWorksheetImport() core/sc/source/filter/oox/worksheethelper.cxx:1625:17 (libscfiltlo.so+0x4f2cff) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #26 oox::xls::WorksheetFragment::finalizeImport() core/sc/source/filter/oox/worksheetfragment.cxx:632:5 (libscfiltlo.so+0x4e91cc) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #27 oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx:53:5 (libooxlo.so+0x1c20d9) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #28 non-virtual thunk to oox::core::FragmentHandler2::endDocument() core/oox/source/core/fragmenthandler2.cxx (libooxlo.so+0x1c20d9)
    #29 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:910:36 (libexpwraplo.so+0x2a06a) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #30 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #31 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #32 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #33 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #34 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #35 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #36 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #37 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #38 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #39 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #40 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #41 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

  Previous write of size 8 at 0x7b5000040f20 by thread T6 (mutexes: write M2):
    #0 std::vector<unsigned long, std::allocator<unsigned long>>::_M_fill_insert(__gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:556:29 (libsclo.so+0x2f6766) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #1 std::vector<unsigned long, std::allocator<unsigned long>>::insert(__gnu_cxx::__normal_iterator<unsigned long const*, std::vector<unsigned long, std::allocator<unsigned long>>>, unsigned long, unsigned long const&) /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1435:2 (libsclo.so+0x2ffd3a) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #2 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::blocks_type::insert(unsigned long, unsigned long) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:99:15 (libsclo.so+0x2ffd3a)
    #3 mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_new_block_to_middle(unsigned long, unsigned long, unsigned long, bool) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:4326:19 (libsclo.so+0x2ffd3a)
    #4 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_middle_of_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3999:19 (libsclo.so+0x3259fe) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #5 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_cell_to_empty_block<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:3313:12 (libsclo.so+0x3259fe)
    #6 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set_impl<double>(unsigned long, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:1260:16 (libsclo.so+0x32492f) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #7 mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::set<double>(mdds::mtv::soa::detail::iterator_base<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell>>, sc::CellStoreTrait>::iterator_trait> const&, unsigned long, double const&) core/workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector/soa/main_def.inl:754:20 (libsclo.so+0x4cc138) (BuildId: 4582437348063bd1c461478348ce37a0dbd28def)
    #8 ScDocumentImport::setNumericCell(ScAddress const&, double) core/sc/source/core/data/documentimport.cxx:259:35 (libsclo.so+0x4cc138)
    #9 oox::xls::SheetDataBuffer::setValueCell(oox::xls::CellModel const&, double) core/sc/source/filter/oox/sheetdatabuffer.cxx:107:20 (libscfiltlo.so+0x4833c0) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #10 oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx:185:25 (libscfiltlo.so+0x48fed2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #11 non-virtual thunk to oox::xls::SheetDataContext::onEndElement() core/sc/source/filter/oox/sheetdatacontext.cxx (libscfiltlo.so+0x48fff9) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #12 oox::core::ContextHandler2Helper::implEndElement(int) core/oox/source/core/contexthandler2.cxx:125:9 (libooxlo.so+0x1ac82b) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #13 oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx:220:5 (libooxlo.so+0x1ac82b)
    #14 non-virtual thunk to oox::core::ContextHandler2::endFastElement(int) core/oox/source/core/contexthandler2.cxx (libooxlo.so+0x1ac82b)
    #15 (anonymous namespace)::Entity::endElement() core/sax/source/fastparser/fastparser.cxx:515:27 (libexpwraplo.so+0x3042f) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #16 sax_fastparser::FastSaxParserImpl::consume((anonymous namespace)::EventList&) core/sax/source/fastparser/fastparser.cxx:1029:25 (libexpwraplo.so+0x29d37) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #17 sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:869:22 (libexpwraplo.so+0x29d37)
    #18 sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) core/sax/source/fastparser/fastparser.cxx:1482:13 (libexpwraplo.so+0x31738) (BuildId: 4c8d8739ce3b93f891afa1e160f975a2892a4af4)
    #19 oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) core/oox/source/core/fastparser.cxx:121:15 (libooxlo.so+0x1ae980) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #20 oox::core::FastParser::parseStream(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) core/oox/source/core/fastparser.cxx:129:5 (libooxlo.so+0x1aebdf) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #21 oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/oox/source/core/xmlfilterbase.cxx:412:21 (libooxlo.so+0x1d01ac) (BuildId: eba40a8f6e1e986eafb2008b5a61a9060f9b6c0b)
    #22 oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) core/sc/source/filter/oox/workbookhelper.cxx:1024:27 (libscfiltlo.so+0x4dbbd2) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #23 oox::xls::(anonymous namespace)::WorkerThread::doWork() core/sc/source/filter/oox/workbookfragment.cxx:249:27 (libscfiltlo.so+0x4d3347) (BuildId: 798032f9cb60957d86e47827d9e882b8931326ba)
    #24 comphelper::ThreadTask::exec() core/comphelper/source/misc/threadpool.cxx:319:9 (libcomphelper.so+0x17dbc1) (BuildId: 30a9bf106ea764f860a55d99b75dd87a0f268335)
    #25 comphelper::ThreadPool::ThreadWorker::execute() core/comphelper/source/misc/threadpool.cxx:85:24 (libcomphelper.so+0x17dbc1)
    #26 salhelper::Thread::run() core/salhelper/source/thread.cxx:39:5 (libuno_salhelpergcc3.so.3+0x5267) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #27 non-virtual thunk to salhelper::Thread::run() core/salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x5267)
    #28 threadFunc core/include/osl/thread.hxx:189:15 (libuno_salhelpergcc3.so.3+0x551e) (BuildId: d146f721ac5d8da923b02df0d671788655b81eb6)
    #29 osl_thread_start_Impl(void*) core/sal/osl/unx/thread.cxx:265:9 (libuno_sal.so.3+0x6a9d5) (BuildId: 767a6cd7c58bf820064a10cf0ab0f15b30c2f4ac)

Change-Id: I7542432749fded8ab5e35f79cb221ad712f7802d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146430
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 6652768)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146531
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit a1f175f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146695
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
tdf-gerrit pushed a commit that referenced this pull request Apr 1, 2023
…Chart"

...as happens during UITest_chart
UITEST_TEST_NAME=tdf107097.tdf107097.test_tdf107097 ever since
86b1929 "tdf#107097: sc: Add UItest" added that
test (see <https://ci.libreoffice.org/job/lo_ubsan/1919/>),

> /chart2/source/tools/XMLRangeHelper.cxx:136:52: runtime error: signed integer overflow: 15 * 308915776 cannot be represented in type 'int'
>     #0 0x2ad74a554918 in (anonymous namespace)::lcl_getSingleCellAddressFromXMLString(rtl::OUString const&, int, int, chart::XMLRangeHelper::Cell&) /chart2/source/tools/XMLRangeHelper.cxx:136:52
>     #1 0x2ad74a553482 in (anonymous namespace)::lcl_getCellAddressFromXMLString(rtl::OUString const&, int, int, chart::XMLRangeHelper::Cell&, rtl::OUString&) /chart2/source/tools/XMLRangeHelper.cxx:217:13
>     #2 0x2ad74a5505da in (anonymous namespace)::lcl_getCellRangeAddressFromXMLString(rtl::OUString const&, int, int, chart::XMLRangeHelper::CellRange&) /chart2/source/tools/XMLRangeHelper.cxx:253:19
>     #3 0x2ad74a54fde1 in chart::XMLRangeHelper::getCellRangeFromXMLString(rtl::OUString const&) /chart2/source/tools/XMLRangeHelper.cxx:328:15
>     #4 0x2ad74a2aed4d in chart::InternalDataProvider::convertRangeFromXML(rtl::OUString const&) /chart2/source/tools/InternalDataProvider.cxx:1227:39
>     #5 0x2ad74a2b0164 in non-virtual thunk to chart::InternalDataProvider::convertRangeFromXML(rtl::OUString const&) /chart2/source/tools/InternalDataProvider.cxx
>     #6 0x2ad6c4784257 in (anonymous namespace)::lcl_ConvertRange(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::chart2::XChartDocument> const&) /xmloff/source/chart/SchXMLPlotAreaContext.cxx:76:32
>     #7 0x2ad6c4779a67 in SchXMLPlotAreaContext::startFastElement(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /xmloff/source/chart/SchXMLPlotAreaContext.cxx:233:34
>     #8 0x2ad6c4c6328a in SvXMLImport::startFastElement(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /xmloff/source/core/xmlimp.cxx:797:15
>     #9 0x2ad704988b78 in (anonymous namespace)::Entity::startElement((anonymous namespace)::Event const*) /sax/source/fastparser/fastparser.cxx:468:27
>     #10 0x2ad70496f681 in sax_fastparser::FastSaxParserImpl::consume((anonymous namespace)::EventList&) /sax/source/fastparser/fastparser.cxx:1026:25
>     #11 0x2ad70496c65f in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:870:22
>     #12 0x2ad7049905d1 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1482:13
>     #13 0x2ad6c4c52b80 in SvXMLImport::parseStream(com::sun::star::xml::sax::InputSource const&) /xmloff/source/core/xmlimp.cxx:504:15
>     #14 0x2ad749aafe1e in chart::XMLFilter::impl_ImportStream(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&, com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> const&, com::sun::star::uno::Reference<com::sun::star::document::XGraphicStorageHandler> const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) /chart2/source/model/filter/XMLFilter.cxx:473:34
>     #15 0x2ad749aa9f01 in chart::XMLFilter::impl_Import(com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /chart2/source/model/filter/XMLFilter.cxx:375:35
>     #16 0x2ad749aa0988 in chart::XMLFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /chart2/source/model/filter/XMLFilter.cxx:221:13
>     #17 0x2ad749c2c76e in chart::ChartModel::impl_load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&) /chart2/source/model/main/ChartModel_Persistence.cxx:567:18
>     #18 0x2ad749c30eea in chart::ChartModel::loadFromStorage(com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /chart2/source/model/main/ChartModel_Persistence.cxx:759:5
>     #19 0x2ad74244b977 in OCommonEmbeddedObject::LoadDocumentFromStorage_Impl() /embeddedobj/source/commonembedding/persistence.cxx:535:19
>     #20 0x2ad7423d7bde in OCommonEmbeddedObject::SwitchStateTo_Impl(int) /embeddedobj/source/commonembedding/embedobj.cxx:185:49
>     #21 0x2ad7423e32ff in OCommonEmbeddedObject::changeState(int) /embeddedobj/source/commonembedding/embedobj.cxx:453:13
>     #22 0x2ad7424b7057 in OCommonEmbeddedObject::getPreferredVisualRepresentation(long) /embeddedobj/source/commonembedding/visobj.cxx:168:9
>     #23 0x2ad67e08fdb6 in comphelper::EmbeddedObjectContainer::GetGraphicReplacementStream(long, com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&, rtl::OUString*) /comphelper/source/container/embeddedobjectcontainer.cxx:1425:54
>     #24 0x2ad6a447182c in svt::EmbeddedObjectRef::GetGraphicReplacementStream(long, com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&, rtl::OUString*) /svtools/source/misc/embedhlp.cxx:809:12
>     #25 0x2ad6a446c7d4 in svt::EmbeddedObjectRef::GetGraphicStream(bool) const /svtools/source/misc/embedhlp.cxx:616:23
>     #26 0x2ad6a4469e58 in svt::EmbeddedObjectRef::GetReplacement(bool) /svtools/source/misc/embedhlp.cxx:424:46
>     #27 0x2ad6a446d4ea in svt::EmbeddedObjectRef::GetGraphic() const /svtools/source/misc/embedhlp.cxx:453:54
>     #28 0x2ad69d4a9470 in SdrOle2Obj::GetGraphic() const /svx/source/svdraw/svdoole2.cxx:1635:33
>     #29 0x2ad71b222d01 in ScDrawTransferObj::ScDrawTransferObj(std::unique_ptr<SdrModel, std::default_delete<SdrModel> >, ScDocShell*, TransferableObjectDescriptor const&) /sc/source/ui/app/drwtrans.cxx:191:107
>     #30 0x2ad71d7da932 in ScDrawView::DoCopy() /sc/source/ui/view/drawvie4.cxx:364:56
>     #31 0x2ad71c1fb75a in ScDrawShell::ExecDrawFunc(SfxRequest&) /sc/source/ui/drawfunc/drawsh5.cxx:328:20
>     #32 0x2ad71c1b181f in SfxStubScDrawShellExecDrawFunc(SfxShell*, SfxRequest&) /workdir/SdiTarget/sc/sdi/scslots.hxx:2823:1
>     #33 0x2ad68de39d05 in SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) /include/sfx2/shell.hxx:197:35
>     #34 0x2ad68ddd1214 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:253:16
>     #35 0x2ad68dde721f in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9
>     #36 0x2ad68dd5edff in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1060:22
>     #37 0x2ad68e24a322 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&) /sfx2/source/control/unoctitm.cxx:758:53
>     #38 0x2ad68e245261 in SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/control/unoctitm.cxx:229:16
>     #39 0x2ad67e465052 in 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&) /comphelper/source/misc/dispatchcommand.cxx:61:12
>     #40 0x2ad67e4657c5 in 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&) /comphelper/source/misc/dispatchcommand.cxx:76:12
>     #41 0x2ad6b39a49a6 in UITest::executeCommand(rtl::OUString const&) /vcl/source/uitest/uitest.cxx:24:12
>     #42 0x2ad6b39b7240 in (anonymous namespace)::UITestUnoObj::executeCommand(rtl::OUString const&) /vcl/source/uitest/uno/uitest_uno.cxx:69:12
>     #43 0x2ad6ee6508db in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) /bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77:5
>     #44 0x2ad6ee64abf2 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233:13
>     #45 0x2ad6ee64773d in unoInterfaceProxyDispatch /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
>     #46 0x2ad6f3a7d2ca in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const /binaryurp/source/incomingrequest.cxx:235:13

Creating a pivot chart apparently generates XML output containing

  <chart:plot-area table:cell-range-address="PivotChart" ...>

which does not conform to ODF, see the mail thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2021-February/086884.html>
"Integer overflow in Calc lcl_getSingleCellAddressFromXMLString nColumn
computation" for details.

And, ignoring the signed-integer-overflow UB for now,
InternalDataProvider::convertRangeFromXML would always have returned an empty
OUString for an input of aXMLRange="PivotChart":
chart::XMLRangeHelper::getCellRangeFromXMLString with rXMLString="PivotChart"
calls lcl_getCellAddressFromXMLString with rXMLString="PivotChart", nStartPos=0,
nEndPos=9, its leading while-loop mis-computes nDelimiterPos=nEndPos, so calls
lcl_getCellAddressFromXMLString with rXMLString="PivotChart", nStartPos=0,
nEndPos=9, its leading while-loop mis-computes nDelimiterPos=nEndPos, so it
doesn't set rOutTableName, so lcl_getCellAddressFromXMLString returns
bResult=false, so chart::XMLRangeHelper::getCellRangeFromXMLString returns an
empty CellRange().

So, similar to 9e5314f "tdf#107097 invoke
internal DP and correctly handle 'range' names" added special handling of
aXMLRange values starting with "PT@" to
InternalDataProvider::convertRangeFromXML, also add explicit special handling
for "PivotChart" (instead of relying on the later code returning an empty
string, but after invoking UB).

Change-Id: I1671f0ab3b3ab00dce8e348aa3b7141ebebaaad5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112207
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 6d43ba1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125233
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Apr 1, 2023
in:
sw/source/core/text/itrform2.cxx:2643 SwTextFormatter::NewFlyCntPortion
at: pFly = static_cast<SwTextFlyCnt*>(pHint)->GetFlyFrame(pFrame)

(gdb) print m_pCurr
$2 = (SwLineLayout *) 0x55ea220a0020

after calling GetFlyFrame m_pCurr is unchanged and we will call
m_pCurr->MaxAscentDescent
on it.

But m_pCurr is deleted during GetFlyFrame by...

 #18 0x00007f98c5cd337f in SwLineLayout::~SwLineLayout() (this=this@entry=0x55ea220a0020, __in_chrg=<optimized out>)
     at source/libo-core/sw/source/core/text/portxt.hxx:26
 #19 0x00007f98c5cd347a in SwParaPortion::~SwParaPortion() (this=0x55ea220a0020, __in_chrg=<optimized out>)
     at source/libo-core/sw/source/core/text/porlay.cxx:2491
 #20 0x00007f98c5cd3485 in SwParaPortion::~SwParaPortion() (this=0x55ea220a0020, __in_chrg=<optimized out>)
     at source/libo-core/sw/source/core/text/porlay.cxx:2491
 #21 0x00007f98c5d05e70 in std::default_delete<SwParaPortion>::operator()(SwParaPortion*) const (__ptr=<optimized out>, this=<optimized out>)
     at /usr/include/c++/8/bits/unique_ptr.h:75
 #22 0x00007f98c5d05e70 in std::unique_ptr<SwParaPortion, std::default_delete<SwParaPortion> >::reset(SwParaPortion*)
     (__p=<optimized out>, this=<optimized out>) at /usr/include/c++/8/bits/unique_ptr.h:382
 #23 0x00007f98c5d05e70 in SwTextLine::SetPara(SwParaPortion*, bool) (bDelete=true, pNew=0x0, this=<optimized out>)
     at source/libo-core/sw/source/core/text/txtcache.hxx:45
 #24 0x00007f98c5d05e70 in SwTextFrame::ClearPara() (this=this@entry=0x55ea21302b60) at source/libo-core/sw/source/core/text/txtcache.cxx:113
 #25 0x00007f98c5d1be89 in SwTextFrame::Init() (this=this@entry=0x55ea21302b60) at source/libo-core/sw/source/core/text/txtfrm.cxx:757
 #26 0x00007f98c5d2630c in SwTextFrame::Prepare(PrepareHint, void const*, bool)
     (this=0x55ea21302b60, ePrep=PrepareHint::FlyFrameArrive, pVoid=<optimized out>, bNotify=<optimized out>)
     at source/libo-core/sw/source/core/text/txtfrm.cxx:3086
 #27 0x00007f98c5b1edb8 in SwFlyInContentFrame::NotifyBackground(SwPageFrame*, SwRect const&, PrepareHint)
     (this=<optimized out>, rRect=..., eHint=<optimized out>) at source/libo-core/sw/inc/anchoredobject.hxx:205
 #28 0x00007f98c5b261a6 in Notify(SwFlyFrame*, SwPageFrame*, SwRect const&, SwRect const*)
     (pFly=pFly@entry=0x55ea21a18d60, pOld=0x0, rOld=SwRect = {...}, pOldPrt=pOldPrt@entry=0x7ffeb50390f8)
     at source/libo-core/sw/source/core/inc/frame.hxx:1177
 #29 0x00007f98c5b2ceca in SwFlyNotify::~SwFlyNotify() (this=0x7ffeb50390d0, __in_chrg=<optimized out>)
     at source/libo-core/sw/source/core/layout/frmtool.cxx:648
 #30 0x00007f98c5b1fa25 in SwFlyInContentFrame::MakeAll(OutputDevice*) (this=0x55ea21a18d60)
     at source/libo-core/sw/source/core/inc/frmtool.hxx:419
 #31 0x00007f98c5aec3a9 in SwFrame::PrepareMake(OutputDevice*) (this=0x55ea21a18d60, pRenderContext=0x55ea212bc4c0)
     at source/libo-core/sw/source/core/layout/calcmove.cxx:375
 #32 0x00007f98c5b17ad2 in SwFlyFrame::Calc(OutputDevice*) const (this=<optimized out>, pRenderContext=<optimized out>)
     at source/libo-core/sw/source/core/layout/fly.cxx:2890
 #33 0x00007f98c5b636c5 in SwObjectFormatter::FormatLayout_(SwLayoutFrame&) (this=this@entry=0x55ea2244d150, _rLayoutFrame=...)
     at source/libo-core/include/rtl/ref.hxx:206
 #34 0x00007f98c5b6413e in SwObjectFormatter::FormatObj_(SwAnchoredObject&) (this=this@entry=0x55ea2244d150, _rAnchoredObj=...)
     at source/libo-core/sw/source/core/layout/objectformatter.cxx:296
 #35 0x00007f98c5b6705b in SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool)
     (this=0x55ea2244d150, _rAnchoredObj=..., _bCheckForMovedFwd=<optimized out>)
     at source/libo-core/sw/source/core/layout/objectformattertxtfrm.cxx:136
 #36 0x00007f98c5b6359f in SwObjectFormatter::FormatObj(SwAnchoredObject&, SwFrame*, SwPageFrame const*)
     (_rAnchoredObj=..., _pAnchorFrame=<optimized out>, _pPageFrame=<optimized out>)
     at source/libo-core/sw/source/core/layout/objectformatter.cxx:190
 #37 0x00007f98c5d717aa in SwTextFlyCnt::GetFlyFrame_(SwFrame const*) (this=this@entry=0x55ea214d8810, pCurrFrame=pCurrFrame@entry=0x55ea21302b60)
     at source/libo-core/sw/source/core/inc/frame.hxx:1177
 #38 0x00007f98c5cb511b in SwTextFlyCnt::GetFlyFrame(SwFrame const*) (pCurrFrame=0x55ea21302b60, this=0x55ea214d8810)
     at source/libo-core/sw/inc/txtflcnt.hxx:48
 #39 0x00007f98c5cb511b in SwTextFormatter::NewFlyCntPortion(SwTextFormatInfo&, SwTextAttr*) const
     (this=this@entry=0x7ffeb503a6b0, rInf=..., pHint=0x55ea214d8810) at source/libo-core/sw/source/core/text/itrform2.cxx:2643

(gdb) print this
(SwLinePortion * const) 0x55ea220a0020

The SwTextFrame of SwTextFrame::ClearPara is the same pFrame/m_pFrame at SwTextFormatter::NewFlyCntPortion

ClearPara is not called if the SwTextFrame is "Locked", so try using that to protect GetFlyFrame

Change-Id: Ia9dcb1f345f6953d995f2acf1ec23492d1680364
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118784
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 7e016df)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125239
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Apr 11, 2023
...e.g. during CppunitTest_sd_import_tests,

> /oox/source/drawingml/colorchoicecontext.cxx:280:78: runtime error: 35000 is outside the range of representable values of type 'short'
>     #0 0x7f3b8abf6278 in oox::drawingml::ColorValueContext::onCreateContext(int, oox::AttributeList const&) /oox/source/drawingml/colorchoicecontext.cxx:280:78
>     #1 0x7f3b8abf6534 in non-virtual thunk to oox::drawingml::ColorValueContext::onCreateContext(int, oox::AttributeList const&) /oox/source/drawingml/colorchoicecontext.cxx
>     #2 0x7f3b8a94baff in oox::core::ContextHandler2Helper::implCreateChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /oox/source/core/contexthandler2.cxx:100:34
>     #3 0x7f3b8a94eabb in oox::core::ContextHandler2::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /oox/source/core/contexthandler2.cxx:204:12
>     #4 0x7f3b8a950484 in non-virtual thunk to oox::core::ContextHandler2::createFastChildContext(int, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> const&) /oox/source/core/contexthandler2.cxx
>     #5 0x7f3b43e81c45 in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:164:67
>     #6 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #7 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #8 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #9 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #10 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #11 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #12 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #13 0x7f3b43e8299e in DOM::CElement::fastSaxify(DOM::Context&) /unoxml/source/dom/element.cxx:181:20
>     #14 0x7f3b43df8a50 in DOM::CDocument::fastSaxify(DOM::Context&) /unoxml/source/dom/document.cxx:289:20
>     #15 0x7f3b43e117af in DOM::CDocument::fastSerialize(com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastDocumentHandler> const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastTokenHandler> const&, com::sun::star::uno::Sequence<com::sun::star::beans::StringPair> const&, com::sun::star::uno::Sequence<com::sun::star::beans::Pair<rtl::OUString, int> > const&) /unoxml/source/dom/document.cxx:1023:9
>     #16 0x7f3b8aa55f81 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastSAXSerializable> const&) /oox/source/core/xmlfilterbase.cxx:470:23
>     #17 0x7f3b8bd30d0f in oox::ppt::PresentationFragmentHandler::importSlide(unsigned int, bool, bool) /oox/source/ppt/presentationfragmenthandler.cxx:357:41
>     #18 0x7f3b8bd3cd16 in oox::ppt::PresentationFragmentHandler::finalizeImport() /oox/source/ppt/presentationfragmenthandler.cxx:543:17
>     #19 0x7f3b8a9f79ae in oox::core::FragmentHandler2::endDocument() /oox/source/core/fragmenthandler2.cxx:53:5
>     #20 0x7f3b548344f0 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:897:36
>     #21 0x7f3b54855150 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1469:13
>     #22 0x7f3b8a97ff11 in oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource const&, bool) /oox/source/core/fastparser.cxx:121:15
>     #23 0x7f3b8a9806a8 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
>     #24 0x7f3b8aa548a4 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:412:21
>     #25 0x7f3b8aa531fd in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) /oox/source/core/xmlfilterbase.cxx:342:12
>     #26 0x7f3b8bcbaf54 in oox::ppt::PowerPointImport::importDocument() /oox/source/ppt/pptimport.cxx:109:17
>     #27 0x7f3b8a99493c in oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/core/filterbase.cxx:488:49
>     #28 0x7f3b8bcbe067 in oox::ppt::PowerPointImport::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /oox/source/ppt/pptimport.cxx:192:24
>     #29 0x7f3b7a89c1c6 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sfx2/source/doc/objstor.cxx:2272:34
>     #30 0x7f3b82834e18 in sd::DrawDocShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) /sd/source/ui/docshell/docshel4.cxx:429:39
>     #31 0x7f3b7a85bd64 in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:739:23
>     #32 0x7f3b7aa63c10 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1940:36
>     #33 0x7f3b7b1c142c 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
>     #34 0x7f3b4ff0f5fb in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1176:37
>     #35 0x7f3b4ff059fb in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:412:20
>     #36 0x7f3b4fefd8bc 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
>     #37 0x7f3b4fef8c50 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
>     #38 0x7f3b4ffc334d 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:593:16
>     #39 0x7f3b4ffc3576 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
>     #40 0x7f3b5feedd95 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
>     #41 0x7f3b75b0aef9 in UnoApiTest::load(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:115:11
>     #42 0x7f3b75b0baf4 in UnoApiTest::loadFromURL(std::basic_string_view<char16_t, std::char_traits<char16_t> >, char const*) /test/source/unoapi_test.cxx:127:5
>     #43 0x7f3b95d2f402 in SdModelTestBase::createSdImpressDoc(char const*, char const*) /sd/qa/unit/sdmodeltestbase.hxx:54:13
>     #44 0x7f3b95d025c8 in testBnc584721_1::TestBody() /sd/qa/unit/import-tests.cxx:1281:5

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

Presumably it was just a typo that f707834
"oox: write color transforms to model::ColorDefinition" used 10.0 rather than 10
as divisor.

Change-Id: I42de6daaa6db86bf4444243ec2c9173d6d514b02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150216
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
tdf-gerrit pushed a commit that referenced this pull request May 8, 2023
bb19817 "MCGR: Make MCGR default for oox
im/export, cleanup" started to cause CppunitTest_chart2_geometry
CPPUNIT_TEST_NAME=Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import to
fail with the below UBSan failure (even though the relevant code appears to be
even older than that commit).

At least for now, lets silence that by explicitly using +INF in case the divisor
is zero (and the dividend is known non-negative).

> /drawinglayer/source/texture/texture.cxx:246:71: runtime error: division by zero
>     #0 0x7f2e61d80f7f in drawinglayer::texture::GeoTexSvxGradientLinear::appendTransformationsAndColors(std::function<void (basegfx::B2DHomMatrix const&, basegfx::BColor const&)>) /drawinglayer/source/texture/texture.cxx:246:71
>     #1 0x7f2e616e187d in drawinglayer::primitive2d::FillGradientPrimitive2D::generateMatricesAndColors(std::function<void (basegfx::B2DHomMatrix const&, basegfx::BColor const&)>) const /drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx:75:31
>     #2 0x7f2e616e4f4f in drawinglayer::primitive2d::FillGradientPrimitive2D::createFill(drawinglayer::primitive2d::Primitive2DContainer&, bool) const /drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx:172:17
>     #3 0x7f2e616e66ca in drawinglayer::primitive2d::FillGradientPrimitive2D::create2DDecomposition(drawinglayer::primitive2d::Primitive2DContainer&, drawinglayer::geometry::ViewInformation2D const&) const /drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx:269:17
>     #4 0x7f2e76cecd04 in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const /drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:36:9
>     #5 0x7f2e619b9278 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>     #6 0x7f2e61a38a25 in drawinglayer::processor2d::VclMetafileProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:917:13
>     #7 0x7f2e619b9a5f in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>     #8 0x7f2e61a5cc3e in drawinglayer::processor2d::VclMetafileProcessor2D::processMaskPrimitive2D(drawinglayer::primitive2d::MaskPrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:2139:13
>     #9 0x7f2e61a3734a in drawinglayer::processor2d::VclMetafileProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:833:13
>     #10 0x7f2e619b9a5f in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>     #11 0x7f2e619b952c in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>     #12 0x7f2e76ced03a in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const /drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:41:14
>     #13 0x7f2e619b9278 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>     #14 0x7f2e61a595e3 in drawinglayer::processor2d::VclMetafileProcessor2D::processPolyPolygonGradientPrimitive2D(drawinglayer::primitive2d::PolyPolygonGradientPrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:2014:9
>     #15 0x7f2e61a36fc0 in drawinglayer::processor2d::VclMetafileProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:821:13
>     #16 0x7f2e619b9a5f in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>     #17 0x7f2e61a2e0da in drawinglayer::processor2d::VclMetafileProcessor2D::impDumpToMetaFile(drawinglayer::primitive2d::Primitive2DContainer const&, GDIMetaFile&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:244:5
>     #18 0x7f2e61a60f4a in drawinglayer::processor2d::VclMetafileProcessor2D::processTransparencePrimitive2D(drawinglayer::primitive2d::TransparencePrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:2292:52
>     #19 0x7f2e61a378cb in drawinglayer::processor2d::VclMetafileProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:851:13
>     #20 0x7f2e619b9a5f in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>     #21 0x7f2e619b952c in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>     #22 0x7f2e76ced03a in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const /drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:41:14
>     #23 0x7f2e619b9278 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>     #24 0x7f2e61a38a25 in drawinglayer::processor2d::VclMetafileProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:917:13
>     #25 0x7f2e619b9a5f in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>     #26 0x7f2e61a68781 in drawinglayer::processor2d::VclMetafileProcessor2D::processObjectInfoPrimitive2D(drawinglayer::primitive2d::ObjectInfoPrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:965:5
>     #27 0x7f2e61a38916 in drawinglayer::processor2d::VclMetafileProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) /drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx:910:13
>     #28 0x7f2e619b9a5f in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) /drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>     #29 0x7f2df2676731 in sdr::contact::ObjectContactOfPageView::DoProcessDisplay(sdr::contact::DisplayInfo&) /svx/source/sdr/contact/objectcontactofpageview.cxx:277:31
>     #30 0x7f2df26741be in sdr::contact::ObjectContactOfPageView::ProcessDisplay(sdr::contact::DisplayInfo&) /svx/source/sdr/contact/objectcontactofpageview.cxx:117:21
>     #31 0x7f2df291809d in SdrPageWindow::RedrawAll(sdr::contact::ViewObjectContactRedirector*) /svx/source/svdraw/sdrpagewindow.cxx:357:28
>     #32 0x7f2df363584c in SdrPageView::CompleteRedraw(SdrPaintWindow&, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) /svx/source/svdraw/svdpagv.cxx:239:18
>     #33 0x7f2df36a80b0 in SdrPaintView::DoCompleteRedraw(SdrPaintWindow&, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) /svx/source/svdraw/svdpntv.cxx:609:21
>     #34 0x7f2df36a7b61 in SdrPaintView::CompleteRedraw(OutputDevice*, vcl::Region const&, sdr::contact::ViewObjectContactRedirector*) /svx/source/svdraw/svdpntv.cxx:522:5
>     #35 0x7f2df3ec0413 in (anonymous namespace)::GraphicExporter::GetGraphic((anonymous namespace)::ExportSettings const&, Graphic&, bool) /svx/source/unodraw/UnoGraphicExporter.cxx:740:24
>     #36 0x7f2df3ec857b in (anonymous namespace)::GraphicExporter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /svx/source/unodraw/UnoGraphicExporter.cxx:1037:19
>     #37 0x7f2db53f082a in chart::ChartView::getMetaFile(com::sun::star::uno::Reference<com::sun::star::io::XOutputStream> const&, bool) /chart2/source/view/main/ChartView.cxx:263:20
>     #38 0x7f2db53f1d43 in chart::ChartView::getTransferData(com::sun::star::datatransfer::DataFlavor const&) /chart2/source/view/main/ChartView.cxx:285:11
>     #39 0x7f2db53f28ae in non-virtual thunk to chart::ChartView::getTransferData(com::sun::star::datatransfer::DataFlavor const&) /chart2/source/view/main/ChartView.cxx
>     #40 0x7f2db586547f in chart::ChartModel::getPreferredVisualRepresentation(long) /chart2/source/model/main/ChartModel.cxx:1054:44
>     #41 0x7f2db586779e in non-virtual thunk to chart::ChartModel::getPreferredVisualRepresentation(long) /chart2/source/model/main/ChartModel.cxx
>     #42 0x7f2db8401589 in OCommonEmbeddedObject::getPreferredVisualRepresentation(long) /embeddedobj/source/commonembedding/visobj.cxx:186:48
>     #43 0x7f2e95742555 in comphelper::EmbeddedObjectContainer::GetGraphicReplacementStream(long, com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&, rtl::OUString*) /comphelper/source/container/embeddedobjectcontainer.cxx:1428:54
>     #44 0x7f2e9573f6b4 in comphelper::EmbeddedObjectContainer::StoreAsChildren(bool, bool, bool, com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&) /comphelper/source/container/embeddedobjectcontainer.cxx:1198:31
>     #45 0x7f2e044c7a1f in SfxObjectShell::SaveAsChildren(SfxMedium&) /sfx2/source/doc/objstor.cxx:3316:38
>     #46 0x7f2e044c6d0c in SfxObjectShell::SaveAs(SfxMedium&) /sfx2/source/doc/objstor.cxx:160:12
>     #47 0x7f2e0c509471 in sd::DrawDocShell::SaveAs(SfxMedium&) /sd/source/ui/docshell/docshel4.cxx:602:33
>     #48 0x7f2e0453a4ec in SfxObjectShell::SaveAsOwnFormat(SfxMedium&) /sfx2/source/doc/objstor.cxx:3256:16
>     #49 0x7f2e0c513d7d in sd::DrawDocShell::SaveAsOwnFormat(SfxMedium&) /sd/source/ui/docshell/docshel4.cxx:924:28
>     #50 0x7f2e044f8b0c in SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) /sfx2/source/doc/objstor.cxx:1457:23
>     #51 0x7f2e04534ef5 in SfxObjectShell::PreDoSaveAs_Impl(rtl::OUString const&, rtl::OUString const&, SfxItemSet const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/objstor.cxx:2993:39
>     #52 0x7f2e0452c40c in SfxObjectShell::CommonSaveAs_Impl(INetURLObject const&, rtl::OUString const&, SfxItemSet&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/objstor.cxx:2783:9
>     #53 0x7f2e04486556 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&) /sfx2/source/doc/objserv.cxx:319:19
>     #54 0x7f2e046d7afe in SfxBaseModel::impl_store(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, bool) /sfx2/source/doc/sfxbasemodel.cxx:3151:42
>     #55 0x7f2e046de8db in SfxBaseModel::storeToURL(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1785:13
>     #56 0x7f2dff75b078 in UnoApiTest::save(rtl::OUString const&, char const*) /test/source/unoapi_test.cxx:174:16
>     #57 0x7f2e63063d61 in Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import() /chart2/qa/extras/chart2geometry.cxx:322:5

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

Change-Id: I72650fba2ee7ba339ec78d24dd690487c31e2600
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151495
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
tdf-gerrit pushed a commit that referenced this pull request May 8, 2023
Similar to <https://gerrit.libreoffice.org/c/core/+/151495> "Avoid division by
zero", CppunitTest_sw_ooxmlexport7 CPPUNIT_TEST_NAME=testFdo78957::TestBody
started to fail with

> drawinglayer/source/texture/texture.cxx:470:71: runtime error: division by zero
>  #0 in drawinglayer::texture::GeoTexSvxGradientRadial::appendTransformationsAndColors(std::function<void (basegfx::B2DHomMatrix const&, basegfx::BColor const&)>) at drawinglayer/source/texture/texture.cxx:470:71
>  #1 in drawinglayer::primitive2d::FillGradientPrimitive2D::generateMatricesAndColors(std::function<void (basegfx::B2DHomMatrix const&, basegfx::BColor const&)>) const at drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx:99:31
>  #2 in drawinglayer::processor2d::VclPixelProcessor2D::processFillGradientPrimitive2D(drawinglayer::primitive2d::FillGradientPrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:1017:24
>  #3 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:363:13
>  #4 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #5 in drawinglayer::processor2d::VclProcessor2D::RenderMaskPrimitive2DPixel(drawinglayer::primitive2d::MaskPrimitive2D const&) at drawinglayer/source/processor2d/vclprocessor2d.cxx:866:9
>  #6 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:257:13
>  #7 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #8 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #9 in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:41:14
>  #10 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #11 in drawinglayer::processor2d::VclPixelProcessor2D::processPolyPolygonGradientPrimitive2D(drawinglayer::primitive2d::PolyPolygonGradientPrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:490:9
>  #12 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:232:13
>  #13 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #14 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #15 in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:41:14
>  #16 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #17 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #18 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #19 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #20 in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:41:14
>  #21 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #22 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #23 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #24 in drawinglayer::processor2d::BaseProcessor2D::visit(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:56:13
>  #25 in drawinglayer::primitive2d::GroupPrimitive2D::getChildren(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&) const at include/drawinglayer/primitive2d/groupprimitive2d.hxx:76:90
>  #26 in drawinglayer::primitive2d::GroupPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const at drawinglayer/source/primitive2d/groupprimitive2d.cxx:53:13
>  #27 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:46:24
>  #28 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:378:13
>  #29 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #30 in drawinglayer::processor2d::VclProcessor2D::RenderTransformPrimitive2D(drawinglayer::primitive2d::TransformPrimitive2D const&) at drawinglayer/source/processor2d/vclprocessor2d.cxx:1004:5
>  #31 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:284:13
>  #32 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #33 in drawinglayer::processor2d::VclProcessor2D::RenderTransformPrimitive2D(drawinglayer::primitive2d::TransformPrimitive2D const&) at drawinglayer/source/processor2d/vclprocessor2d.cxx:1004:5
>  #34 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:284:13
>  #35 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #36 in drawinglayer::processor2d::VclProcessor2D::RenderTransformPrimitive2D(drawinglayer::primitive2d::TransformPrimitive2D const&) at drawinglayer/source/processor2d/vclprocessor2d.cxx:1004:5
>  #37 in drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(drawinglayer::primitive2d::BasePrimitive2D const&) at drawinglayer/source/processor2d/vclpixelprocessor2d.cxx:284:13
>  #38 in drawinglayer::processor2d::BaseProcessor2D::process(drawinglayer::primitive2d::Primitive2DContainer const&) at drawinglayer/source/processor2d/baseprocessor2d.cxx:68:21
>  #39 in drawinglayer::convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&&, drawinglayer::geometry::ViewInformation2D const&, unsigned int, unsigned int, unsigned int) at drawinglayer/source/tools/converters.cxx:217:24
>  #40 in drawinglayer::convertPrimitive2DContainerToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&&, basegfx::B2DRange const&, unsigned int, o3tl::Length, std::optional<Size> const&) at drawinglayer/source/tools/converters.cxx:332:28
>  #41 in SvxShape::GetBitmap(bool) const at svx/source/unodraw/unoshape.cxx:717:21
>  #42 in SvxShape::getPropertyValueImpl(rtl::OUString const&, SfxItemPropertyMapEntry const*, com::sun::star::uno::Any&) at svx/source/unodraw/unoshape.cxx:2597:18
>  #43 in SvxCustomShape::getPropertyValueImpl(rtl::OUString const&, SfxItemPropertyMapEntry const*, com::sun::star::uno::Any&) at svx/source/unodraw/unoshap2.cxx:1780:26
>  #44 in SvxShape::_getPropertyValue(rtl::OUString const&) at svx/source/unodraw/unoshape.cxx:1638:14
>  #45 in SvxShape::getPropertyValue(rtl::OUString const&) at svx/source/unodraw/unoshape.cxx:1622:16
>  #46 in non-virtual thunk to SvxShape::getPropertyValue(rtl::OUString const&) at svx/source/unodraw/unoshape.cxx
>  #47 in SwXShape::_getPropAtAggrObj(rtl::OUString const&) at sw/source/core/unocore/unodraw.cxx:1823:23
>  #48 in SwXShape::getPropertyValue(rtl::OUString const&) at sw/source/core/unocore/unodraw.cxx:1753:20
>  #49 in non-virtual thunk to SwXShape::getPropertyValue(rtl::OUString const&) at sw/source/core/unocore/unodraw.cxx
>  #50 in writerfilter::TagLogger::unoPropertySet(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&) at writerfilter/source/dmapper/TagLogger.cxx:123:47
>  #51 in writerfilter::dmapper::DomainMapper_Impl::PushShapeContext(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) at writerfilter/source/dmapper/DomainMapper_Impl.cxx:4204:38
>  #52 in writerfilter::dmapper::DomainMapper::lcl_startShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) at writerfilter/source/dmapper/DomainMapper.cxx:3680:18
>  #53 in writerfilter::LoggedStream::startShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const&) at writerfilter/source/dmapper/LoggedResources.cxx:139:5
>  #54 in writerfilter::ooxml::OOXMLFastContextHandlerShape::sendShape(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1810:19
>  #55 in writerfilter::ooxml::OOXMLFastContextHandlerShape::lcl_endFastElement(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1829:9
>  #56 in writerfilter::ooxml::OOXMLFastContextHandler::endFastElement(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:223:9
>  #57 in (anonymous namespace)::Entity::endElement() at sax/source/fastparser/fastparser.cxx:515:27
>  #58 in sax_fastparser::FastSaxParserImpl::callbackEndElement() at sax/source/fastparser/fastparser.cxx:1330:17
>  #59 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) at sax/source/fastparser/fastparser.cxx:339:18
>  #60 in xmlParseEndTag2 at workdir/UnpackedTarball/libxml2/parser.c:9742:2
>  #61 in xmlParseTryOrFinish at workdir/UnpackedTarball/libxml2/parser.c:11642:14
>  #62 in xmlParseChunk at workdir/UnpackedTarball/libxml2/parser.c:12351:13
>  #63 in sax_fastparser::FastSaxParserImpl::parse() at sax/source/fastparser/fastparser.cxx:1111:25
>  #64 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:891:9
>  #65 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:1469:13
>  #66 in writerfilter::ooxml::OOXMLDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:515:18
>  #67 in writerfilter::dmapper::DomainMapper_Impl::substream(unsigned int, tools::SvRef<writerfilter::Reference<writerfilter::Stream>> const&) at writerfilter/source/dmapper/DomainMapper_Impl.cxx:9143:14
>  #68 in writerfilter::dmapper::DomainMapper::lcl_substream(unsigned int, tools::SvRef<writerfilter::Reference<writerfilter::Stream>>) at writerfilter/source/dmapper/DomainMapper.cxx:4390:14
>  #69 in writerfilter::LoggedStream::substream(unsigned int, tools::SvRef<writerfilter::Reference<writerfilter::Stream>>) at writerfilter/source/dmapper/LoggedResources.cxx:272:5
>  #70 in writerfilter::ooxml::OOXMLDocumentImpl::resolveFastSubStreamWithId(writerfilter::Stream&, tools::SvRef<writerfilter::Reference<writerfilter::Stream>> const&, unsigned int) at writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:126:13
>  #71 in writerfilter::ooxml::OOXMLDocumentImpl::resolveHeader(writerfilter::Stream&, int, rtl::OUString const&) at writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:385:10
>  #72 in writerfilter::ooxml::OOXMLFastContextHandler::resolveHeader(int, rtl::OUString const&) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:888:35
>  #73 in writerfilter::ooxml::OOXMLHeaderHandler::finalize() at writerfilter/source/ooxml/Handler.cxx:214:20
>  #74 in writerfilter::ooxml::OOXMLFastContextHandlerProperties::handleHdrFtr() at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1113:28
>  #75 in writerfilter::ooxml::OOXMLFactory_wml::endAction(writerfilter::ooxml::OOXMLFastContextHandler*) at workdir/CustomTarget/writerfilter/source/ooxml/OOXMLFactory_wml.cxx:7482:26
>  #76 in writerfilter::ooxml::OOXMLFactory::endAction(writerfilter::ooxml::OOXMLFastContextHandler*) at writerfilter/source/ooxml/OOXMLFactory.cxx:157:19
>  #77 in writerfilter::ooxml::OOXMLFastContextHandler::endAction() at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:316:5
>  #78 in writerfilter::ooxml::OOXMLFastContextHandlerProperties::lcl_endFastElement(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1034:9
>  #79 in writerfilter::ooxml::OOXMLFastContextHandler::endFastElement(int) at writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:223:9
>  #80 in (anonymous namespace)::Entity::endElement() at sax/source/fastparser/fastparser.cxx:515:27
>  #81 in sax_fastparser::FastSaxParserImpl::callbackEndElement() at sax/source/fastparser/fastparser.cxx:1330:17
>  #82 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) at sax/source/fastparser/fastparser.cxx:339:18
>  #83 in xmlParseTryOrFinish at workdir/UnpackedTarball/libxml2/parser.c:11493:8
>  #84 in xmlParseChunk at workdir/UnpackedTarball/libxml2/parser.c:12351:13
>  #85 in sax_fastparser::FastSaxParserImpl::parse() at sax/source/fastparser/fastparser.cxx:1086:21
>  #86 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:891:9
>  #87 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) at sax/source/fastparser/fastparser.cxx:1469:13
>  #88 in writerfilter::ooxml::OOXMLDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:515:18
>  #89 in (anonymous namespace)::WriterFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at writerfilter/source/filter/WriterFilter.cxx:208:24
>  #90 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2272:34
>  #91 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:739:23
>  #92 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1940:36
>  #93 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&) at sfx2/source/view/frmload.cxx:720:28
>  #94 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37
>  #95 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20
>  #96 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) at framework/source/loadenv/loadenv.cxx:308:5
>  #97 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&) at framework/source/loadenv/loadenv.cxx:168:14
>  #98 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:593:16
>  #99 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&) at framework/source/services/desktop.cxx
>  #100 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:71:62
>  #101 in UnoApiTest::load(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:115:11
>  #102 in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) at sw/qa/unit/swmodeltestbase.cxx:470:20
>  #103 in SwModelTestBase::load(char const*, char const*) at sw/qa/inc/swmodeltestbase.hxx:353:16
>  #104 in SwModelTestBase::loadAndSave(char const*) at sw/qa/unit/swmodeltestbase.cxx:523:5
>  #105 in testFdo78957::TestBody() at sw/qa/extras/ooxmlexport/ooxmlexport7.cxx:783:5

Change-Id: Ifbc7da0b6c971df61e9908cc02b10a9f50769fcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151496
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
tdf-gerrit pushed a commit that referenced this pull request Aug 6, 2023
commit 7f85415 caused

> 0x7f206906bd30: note: object is of type 'sw::VirtPageNumHint'
>  80 60 00 00  f0 33 8b 16 20 7f 00 00  6d 00 00 00 00 00 00 00  00 00
00 00 00 00 00 00  80 94 5c 00
>               ^~~~~~~~~~~~~~~~~~~~~~~
>               vptr for 'sw::VirtPageNumHint'
>     #0 0x7f2007e0e38b in SwTabFrame::SwClientNotify(SwModify const&,
SfxHint const&) /sw/source/core/layout/tabfrm.cxx:3525:20
>     #1 0x7f2004957b22 in SwModify::CallSwClientNotify(SfxHint const&)
const /sw/source/core/attr/calbck.cxx:322:18
>     #2 0x7f2004957e25 in
sw::BroadcastingModify::CallSwClientNotify(SfxHint const&) const
/sw/source/core/attr/calbck.cxx:327:15
>     #3 0x7f2007ea97eb in SwFrame::GetVirtPageNum() const
/sw/source/core/layout/trvlfrm.cxx:1844:19
>     #4 0x7f20089f092b in
SwTextFormatter::NewFieldPortion(SwTextFormatInfo&, SwTextAttr const*)
const /sw/source/core/text/txtfld.cxx:160:47
>     #5 0x7f20089f9be6 in
SwTextFormatter::NewExtraPortion(SwTextFormatInfo&)
/sw/source/core/text/txtfld.cxx:382:20
>     #6 0x7f200863dbe8 in
SwTextFormatter::NewPortion(SwTextFormatInfo&,
std::optional<o3tl::strong_int<int, Tag_TextFrameIndex> >)
/sw/source/core/text/itrform2.cxx:1737:28
>     #7 0x7f200862661f in
SwTextFormatter::BuildPortions(SwTextFormatInfo&)
/sw/source/core/text/itrform2.cxx:440:27
>     #8 0x7f200865f573 in
SwTextFormatter::FormatLine(o3tl::strong_int<int, Tag_TextFrameIndex>)
/sw/source/core/text/itrform2.cxx:1952:9
>     #9 0x7f200844aef2 in SwTextFrame::FormatLine(SwTextFormatter&,
bool) /sw/source/core/text/frmform.cxx:1303:44
>     #10 0x7f2008459474 in SwTextFrame::Format_(SwTextFormatter&,
SwTextFormatInfo&, bool) /sw/source/core/text/frmform.cxx:1663:23
>     #11 0x7f200845edcb in SwTextFrame::FormatImpl(OutputDevice*,
SwParaPortion*, std::__debug::vector<SwAnchoredObject*,
std::allocator<SwAnchoredObject*> >&)
/sw/source/core/text/frmform.cxx:1854:5
>     #12 0x7f2008465458 in SwTextFrame::Format(OutputDevice*,
SwBorderAttrs const*) /sw/source/core/text/frmform.cxx:2058:17
>     #13 0x7f200758ac43 in SwContentFrame::MakeAll(OutputDevice*)
/sw/source/core/layout/calcmove.cxx:1515:17
>     #14 0x7f200755b0a1 in SwFrame::OptPrepareMake()
/sw/source/core/layout/calcmove.cxx:399:9
>     #15 0x7f2007953230 in SwFrame::OptCalc() const
/sw/source/core/inc/frame.hxx:1090:37
>     #16 0x7f20079208f7 in SwLayAction::FormatLayout(OutputDevice*,
SwLayoutFrame*, bool) /sw/source/core/layout/layact.cxx:1430:19
>     #17 0x7f200792060a in SwLayAction::FormatLayout(OutputDevice*,
SwLayoutFrame*, bool) /sw/source/core/layout/layact.cxx:1423:29
>     #18 0x7f20079344a2 in SwLayAction::FormatLayoutTab(SwTabFrame*,
bool) /sw/source/core/layout/layact.cxx:1642:25
>     #19 0x7f2007920133 in SwLayAction::FormatLayout(OutputDevice*,
SwLayoutFrame*, bool) /sw/source/core/layout/layact.cxx:1417:32
>     #20 0x7f200792060a in SwLayAction::FormatLayout(OutputDevice*,
SwLayoutFrame*, bool) /sw/source/core/layout/layact.cxx:1423:29
>     #21 0x7f2007908ac6 in SwLayAction::InternalAction(OutputDevice*)
/sw/source/core/layout/layact.cxx:591:25
>     #22 0x7f2007903d4e in SwLayAction::Action(OutputDevice*)
/sw/source/core/layout/layact.cxx:388:5
>     #23 0x7f200a3ff241 in SwViewShell::ImplEndAction(bool)
/sw/source/core/view/viewsh.cxx:309:17
>     #24 0x7f2004ccef61 in SwViewShell::EndAction(bool)
/sw/inc/viewsh.hxx:628:9
>     #25 0x7f2004c2e8a0 in SwCursorShell::EndAction(bool)
/sw/source/core/crsr/crsrsh.cxx:263:18
>     #26 0x7f200c9ff99c in SwView::OuterResizePixel(Point const&, Size
const&) /sw/source/uibase/uiview/viewport.cxx:1107:22
>     #27 0x7f2026f7a582 in
SfxViewFrame::DoAdjustPosSizePixel(SfxViewShell*, Point const&, Size
const&, bool) /sfx2/source/view/viewfrm.cxx:2058:18
>     #28 0x7f2026fa205f in SfxViewFrame::Resize(bool)
/sfx2/source/view/viewfrm.cxx:2852:13
>     #29 0x7f2026ff3179 in SfxFrameViewWindow_Impl::Resize()
/sfx2/source/view/viewfrm2.cxx:72:17
>     #30 0x7f204ea688e0 in vcl::Window::ImplCallResize()
/vcl/source/window/event.cxx:525:5
>     #31 0x7f204f23f74b in vcl::Window::Show(bool, ShowFlags)
/vcl/source/window/window.cxx:2293:13
>     #32 0x7f2026e731b8 in
SfxBaseController::ConnectSfxFrame_Impl(SfxBaseController::ConnectSfxFrame)
/sfx2/source/view/sfxbasecontroller.cxx:1182:24
>     #33 0x7f2026e6f0aa in
SfxBaseController::attachFrame(com::sun::star::uno::Reference<com::sun::star::frame::XFrame>
const&) /sfx2/source/view/sfxbasecontroller.cxx:530:9
>     #34 0x7f2026dd0b8e in
utl::ConnectFrameControllerModel(com::sun::star::uno::Reference<com::sun::star::frame::XFrame>
const&,
com::sun::star::uno::Reference<com::sun::star::frame::XController2>
const&, com::sun::star::uno::Reference<com::sun::star::frame::XModel>
const&) /include/unotools/fcm.hxx:48:18
>     #35 0x7f2026dc47e3 in (anonymous
namespace)::SfxFrameLoader_Impl::impl_createDocumentView(com::sun::star::uno::Reference<com::sun::star::frame::XModel2>
const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame>
const&, comphelper::NamedValueCollection const&, rtl::OUString const&)
/sfx2/source/view/frmload.cxx:584:5
>     #36 0x7f2026dbbfde 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:759:13
>     #37 0x7f1fd762b75b in framework::LoadEnv::impl_loadContent()
/framework/source/loadenv/loadenv.cxx:1176:37
>     #38 0x7f1fd7621b5b in framework::LoadEnv::start()
/framework/source/loadenv/loadenv.cxx:412:20
>     #39 0x7f1fd7619a1c 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
>     #40 0x7f1fd7614d57 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
>     #41 0x7f1fd76ed70d 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:593:16
>     #42 0x7f1fd76ed936 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
>     #43 0x7f1ff52cbb7a 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
>     #44 0x7f20214a91ac in UnoApiTest::load(rtl::OUString const&, char
const*) /test/source/unoapi_test.cxx:115:11
>     #45 0x7f1ff578a483 in SwModelTestBase::loadURL(rtl::OUString
const&, char const*) /sw/qa/unit/swmodeltestbase.cxx:468:20
>     #46 0x7f1ff578df71 in SwModelTestBase::loadAndSave(char const*,
char const*) /sw/qa/unit/swmodeltestbase.cxx:486:5
>     #47 0x7f202d75f0b9 in testCrashWhileSave::TestBody()
/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx:1016:5

during CppunitTest_sw_ooxmlexport3
(<https://ci.libreoffice.org/job/lo_ubsan/2871/>).

Change-Id: I41838d3493bd4b1a68cb29cf1e90494eb8db0077
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155383
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
tdf-gerrit pushed a commit that referenced this pull request Aug 18, 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 #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
    #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
    #2  0x00007ffff6b1028a in comphelper::OCommonAccessibleComponent::disposing() (this=0x55555cecfdf0) at .../comphelper/source/misc/accessiblecomponenthelper.cxx:61
    #3  0x00007ffff6674aeb in cppu::WeakComponentImplHelperBase::dispose() (this=0x55555cecfdf0) at .../cppuhelper/source/implbase.cxx:104
    #4  0x00007ffff2ddf0e0 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::dispose() (this=0x55555cecfdf0)
        at .../include/cppuhelper/compbase.hxx:90
    #5  0x00007ffff6674834 in cppu::WeakComponentImplHelperBase::release() (this=0x55555cecfdf0) at .../cppuhelper/source/implbase.cxx:79
    #6  0x00007ffff2ddf642 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/compbase.hxx:86
    #7  0x00007ffff2ddf378 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleComponent>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/implbase.hxx:171
    #8  0x00007ffff2ddf0a0 in cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper, com::sun::star::accessibility::XAccessible>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/implbase.hxx:171
    #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
    #10 0x00007fffe3f288de in atk_object_wrapper_dispose(AtkObjectWrapper*) (wrapper=0x55555d409fa0) at .../vcl/unx/gtk3/a11y/atkwrapper.cxx:1078
    #11 0x00007fffe3f27527 in atk_object_wrapper_finalize(GObject*) (obj=0x55555d409fa0) at .../vcl/unx/gtk3/a11y/atkwrapper.cxx:674
    #12 0x00007ffff138c48c in g_object_unref () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #13 0x00007fffe3f003f7 in AtkListener::~AtkListener() (this=0x55555ce6ecb0, __in_chrg=<optimized out>) at .../vcl/unx/gtk3/a11y/atklistener.cxx:57
    #14 0x00007fffe3f0042e in AtkListener::~AtkListener() (this=0x55555ce6ecb0, __in_chrg=<optimized out>) at .../vcl/unx/gtk3/a11y/atklistener.cxx:58
    #15 0x00007ffff6756838 in cppu::OWeakObject::release() (this=0x55555ce6ecb0) at .../cppuhelper/source/weak.cxx:230
    #16 0x00007fffe3f0a7de in cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release() (this=0x55555ce6ecb0) at .../include/cppuhelper/implbase.hxx:115
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #27 0x00007ffff6b145b4 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::~OInterfaceContainerHelper4() (this=0x55555d40a0b0, __in_chrg=<optimized out>)
        at .../include/comphelper/interfacecontainer4.hxx:126
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #36 0x00007ffff6b14151 in comphelper::AccessibleEventNotifier::shutdown() () at .../comphelper/source/misc/accessibleeventnotifier.cxx:268
    #37 0x00007fffee53fa20 in DeInitVCL() () at .../vcl/source/app/svmain.cxx:594
    #38 0x00007fffee53e227 in ImplSVMain() () at .../vcl/source/app/svmain.cxx:229
    #39 0x00007fffee53e283 in SVMain() () at .../vcl/source/app/svmain.cxx:236
    #40 0x00007ffff7a9f51d in soffice_main() () at .../desktop/source/app/sofficemain.cxx:94
    #41 0x00005555555549d4 in sal_main () at .../desktop/source/app/main.c:51
    #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 <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Aug 22, 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 #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
    #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
    #2  0x00007ffff6b1028a in comphelper::OCommonAccessibleComponent::disposing() (this=0x55555cecfdf0) at .../comphelper/source/misc/accessiblecomponenthelper.cxx:61
    #3  0x00007ffff6674aeb in cppu::WeakComponentImplHelperBase::dispose() (this=0x55555cecfdf0) at .../cppuhelper/source/implbase.cxx:104
    #4  0x00007ffff2ddf0e0 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::dispose() (this=0x55555cecfdf0)
        at .../include/cppuhelper/compbase.hxx:90
    #5  0x00007ffff6674834 in cppu::WeakComponentImplHelperBase::release() (this=0x55555cecfdf0) at .../cppuhelper/source/implbase.cxx:79
    #6  0x00007ffff2ddf642 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext2, com::sun::star::accessibility::XAccessibleEventBroadcaster>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/compbase.hxx:86
    #7  0x00007ffff2ddf378 in cppu::ImplInheritanceHelper<comphelper::OCommonAccessibleComponent, com::sun::star::accessibility::XAccessibleComponent>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/implbase.hxx:171
    #8  0x00007ffff2ddf0a0 in cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper, com::sun::star::accessibility::XAccessible>::release() (this=0x55555cecfdf0)
        at .../include/cppuhelper/implbase.hxx:171
    #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
    #10 0x00007fffe3f288de in atk_object_wrapper_dispose(AtkObjectWrapper*) (wrapper=0x55555d409fa0) at .../vcl/unx/gtk3/a11y/atkwrapper.cxx:1078
    #11 0x00007fffe3f27527 in atk_object_wrapper_finalize(GObject*) (obj=0x55555d409fa0) at .../vcl/unx/gtk3/a11y/atkwrapper.cxx:674
    #12 0x00007ffff138c48c in g_object_unref () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #13 0x00007fffe3f003f7 in AtkListener::~AtkListener() (this=0x55555ce6ecb0, __in_chrg=<optimized out>) at .../vcl/unx/gtk3/a11y/atklistener.cxx:57
    #14 0x00007fffe3f0042e in AtkListener::~AtkListener() (this=0x55555ce6ecb0, __in_chrg=<optimized out>) at .../vcl/unx/gtk3/a11y/atklistener.cxx:58
    #15 0x00007ffff6756838 in cppu::OWeakObject::release() (this=0x55555ce6ecb0) at .../cppuhelper/source/weak.cxx:230
    #16 0x00007fffe3f0a7de in cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release() (this=0x55555ce6ecb0) at .../include/cppuhelper/implbase.hxx:115
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #27 0x00007ffff6b145b4 in comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::~OInterfaceContainerHelper4() (this=0x55555d40a0b0, __in_chrg=<optimized out>)
        at .../include/comphelper/interfacecontainer4.hxx:126
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #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
    #36 0x00007ffff6b14151 in comphelper::AccessibleEventNotifier::shutdown() () at .../comphelper/source/misc/accessibleeventnotifier.cxx:268
    #37 0x00007fffee53fa20 in DeInitVCL() () at .../vcl/source/app/svmain.cxx:594
    #38 0x00007fffee53e227 in ImplSVMain() () at .../vcl/source/app/svmain.cxx:229
    #39 0x00007fffee53e283 in SVMain() () at .../vcl/source/app/svmain.cxx:236
    #40 0x00007ffff7a9f51d in soffice_main() () at .../desktop/source/app/sofficemain.cxx:94
    #41 0x00005555555549d4 in sal_main () at .../desktop/source/app/main.c:51
    #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 <m.weghorn@posteo.de>
(cherry picked from commit 79cc574)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155781
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Aug 30, 2023
When disposing the `SvHeaderTabListBox`, also dispose
the a11y objects for its header cells and clear
the vector.

This fixes a crash on exit that could e.g. be triggered
as follows when using the qt6 VCL plugin on Linux:

1) start accerciser
2) start Writer with qt6 VCL plugin
3) press Alt+F12 to open the options dialog
4) enable "LibreOfficeDev" -> "Advanced" (i.e. Java Options dialog)
5) in Accerciser, click through LO a11y hierarchy, in particular on all of the cells of the JRE table
6) close the dialog and LO

Backtrace:

    ~"#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44\n"
    >~"#1  0x00007f0f296a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78\n"
    >~"#2  0x00007f0f2965a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26\n"
    >~"#3  0x00007f0f296444b2 in __GI_abort () at ./stdlib/abort.c:79\n"
    >~"#4  0x00007f0f296443d5 in __assert_fail_base (fmt=0x7f0f297b8dc8 \"%s%s%s:%u: %s%sAssertion `%s' failed.\\n%n\", assertion=assertion@entry=0x7f0f28b376a0 \"rClients.end() != rPos && \\\"AccessibleEventNotifier::implLookupClient: invalid client id \\\" \\\"(did you register your client?)!\\\"\", file=file@entry=0x7f0f28b37478 \".../comphelper/source/misc/accessibleeventnotifier.cxx\", line=line@entry=140, function=function@entry=0x7f0f28b375b0 \"bool {anonymous}::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::iterator&)\") at ./assert/assert.c:92\n"
    >~"#5  0x00007f0f296533a2 in __assert_fail (assertion=0x7f0f28b376a0 \"rClients.end() != rPos && \\\"AccessibleEventNotifier::implLookupClient: invalid client id \\\" \\\"(did you register your client?)!\\\"\", file=0x7f0f28b37478 \".../comphelper/source/misc/accessibleeventnotifier.cxx\", line=140, function=0x7f0f28b375b0 \"bool {anonymous}::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::iterator&)\") at ./assert/assert.c:101\n"
    >~"#6  0x00007f0f28913886 in (anonymous namespace)::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, 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> > > >::iterator&) (nClient=218, rPos=...) at .../comphelper/source/misc/accessibleeventnotifier.cxx:140\n"

    >~"#7  0x00007f0f28913b9a in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (_nClient=218, _rxEventSource=uno::Reference to (accessibility::AccessibleBrowseBoxHeaderCell *) 0x55fb25c8b3d0) at .../comphelper/source/misc/accessibleeventnotifier.cxx:185\n"
    >~"#8  0x00007f0eef073244 in accessibility::AccessibleBrowseBoxBase::disposing() (this=0x55fb25c8b3d0) at .../accessibility/source/extended/AccessibleBrowseBoxBase.cxx:113\n"
    >~"#9  0x00007f0f28474aeb in cppu::WeakComponentImplHelperBase::dispose() (this=0x55fb25c8b3d0) at .../cppuhelper/source/implbase.cxx:104\n"
    >~"#10 0x00007f0eef0712c2 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XFocusListener, com::sun::star::lang::XServiceInfo>::dispose() (this=0x55fb25c8b3d0) at .../include/cppuhelper/compbase.hxx:90\n"
    >~"#11 0x00007f0f28474834 in cppu::WeakComponentImplHelperBase::release() (this=0x55fb25c8b3d0) at .../cppuhelper/source/implbase.cxx:79\n"
    >~"#12 0x00007f0eef072124 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XFocusListener, com::sun::star::lang::XServiceInfo>::release() (this=0x55fb25c8b3d0) at .../include/cppuhelper/compbase.hxx:86\n"
    >~"#13 0x00007f0eef07544a in accessibility::BrowseBoxAccessibleElement::release() (this=0x55fb25c8b3d0) at .../accessibility/source/extended/AccessibleBrowseBoxBase.cxx:518\n"
    >~"#14 0x00007f0f15842747 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>::~Reference() (this=0x7f0f0c0246e0, __in_chrg=<optimized out>) at .../include/com/sun/star/uno/Reference.hxx:114\n"

    >~"#15 0x00007f0f15862b9f in QtAccessibleWidget::~QtAccessibleWidget() (this=0x7f0f0c0246a0, __in_chrg=<optimized out>) at .../vcl/inc/qt6/../qt5/QtAccessibleWidget.hxx:39\n"
    >~"#16 0x00007f0f15862c76 in QtAccessibleWidget::~QtAccessibleWidget() (this=0x7f0f0c0246a0, __in_chrg=<optimized out>) at .../vcl/inc/qt6/../qt5/QtAccessibleWidget.hxx:39\n"
    >~"#17 0x00007f0f146ca101 in QAccessibleCache::deleteInterface(unsigned int, QObject*) (this=0x55fb1ef073e0, id=2147483876, obj=0x55fb25c8abf0) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:173\n"
    >~"#18 0x00007f0f146c9712 in QAccessibleCache::~QAccessibleCache() (this=0x55fb1ef073e0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:31\n"
    >~"#19 0x00007f0f146c9798 in QAccessibleCache::~QAccessibleCache() (this=0x55fb1ef073e0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:32\n"
    >~"#20 0x00007f0f146c967e in cleanupAccessibleCache() () at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:24\n"
    >~"#21 0x00007f0f14fa22f7 in qt_call_post_routines() () at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:325\n"

    >~"#22 0x00007f0f13599da0 in QApplication::~QApplication() (this=0x55fb1dfd77b0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:663\n"
    >~"#23 0x00007f0f1359a09e in QApplication::~QApplication() (this=0x55fb1dfd77b0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:717\n"
    >~"#24 0x00007f0f158ce2c4 in std::default_delete<QApplication>::operator()(QApplication*) const (this=0x55fb1e07b220, __ptr=0x55fb1dfd77b0) at /usr/include/c++/13/bits/unique_ptr.h:99\n"
    >~"#25 0x00007f0f158ce70c in std::__uniq_ptr_impl<QApplication, std::default_delete<QApplication> >::reset(QApplication*) (this=0x55fb1e07b220, __p=0x0) at /usr/include/c++/13/bits/unique_ptr.h:211\n"
    >~"#26 0x00007f0f158cc643 in std::unique_ptr<QApplication, std::default_delete<QApplication> >::reset(QApplication*) (this=0x55fb1e07b220, __p=0x0) at /usr/include/c++/13/bits/unique_ptr.h:509\n"

    >~"#27 0x00007f0f158c506b in QtInstance::~QtInstance() (this=0x55fb1e07b090, __in_chrg=<optimized out>) at .../vcl/qt6/../qt5/QtInstance.cxx:273\n"
    >~"#28 0x00007f0f158c5142 in QtInstance::~QtInstance() (this=0x55fb1e07b090, __in_chrg=<optimized out>) at .../vcl/qt6/../qt5/QtInstance.cxx:274\n"

    >~"#29 0x00007f0f202615d9 in DestroySalInstance(SalInstance*) (pInst=0x55fb1e07b0a0) at .../vcl/source/app/salplug.cxx:389\n"
    >~"#30 0x00007f0f203401ee in DeInitVCL() () at .../vcl/source/app/svmain.cxx:600\n"
    >~"#31 0x00007f0f2033e9bf in ImplSVMain() () at .../vcl/source/app/svmain.cxx:229\n"
    >~"#32 0x00007f0f2033ea1b in SVMain() () at .../vcl/source/app/svmain.cxx:236\n"
    >~"#33 0x00007f0f2989f6ed in soffice_main() () at .../desktop/source/app/sofficemain.cxx:94\n"
    >~"#34 0x000055fb1c8769d4 in sal_main () at .../desktop/source/app/main.c:51\n"
    >~"#35 0x000055fb1c8769ba in main (argc=3, argv=0x7fffd6677498) at .../desktop/source/app/main.c:49\n"

Change-Id: Ic5ba4f75cbeac3955417ca54c189b262289bfc79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156259
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Sep 1, 2023
When disposing the `SvHeaderTabListBox`, also dispose
the a11y objects for its header cells and clear
the vector.

This fixes a crash on exit that could e.g. be triggered
as follows when using the qt6 VCL plugin on Linux:

1) start accerciser
2) start Writer with qt6 VCL plugin
3) press Alt+F12 to open the options dialog
4) enable "LibreOfficeDev" -> "Advanced" (i.e. Java Options dialog)
5) in Accerciser, click through LO a11y hierarchy, in particular on all of the cells of the JRE table
6) close the dialog and LO

Backtrace:

    ~"#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44\n"
    >~"#1  0x00007f0f296a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78\n"
    >~"#2  0x00007f0f2965a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26\n"
    >~"#3  0x00007f0f296444b2 in __GI_abort () at ./stdlib/abort.c:79\n"
    >~"#4  0x00007f0f296443d5 in __assert_fail_base (fmt=0x7f0f297b8dc8 \"%s%s%s:%u: %s%sAssertion `%s' failed.\\n%n\", assertion=assertion@entry=0x7f0f28b376a0 \"rClients.end() != rPos && \\\"AccessibleEventNotifier::implLookupClient: invalid client id \\\" \\\"(did you register your client?)!\\\"\", file=file@entry=0x7f0f28b37478 \".../comphelper/source/misc/accessibleeventnotifier.cxx\", line=line@entry=140, function=function@entry=0x7f0f28b375b0 \"bool {anonymous}::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::iterator&)\") at ./assert/assert.c:92\n"
    >~"#5  0x00007f0f296533a2 in __assert_fail (assertion=0x7f0f28b376a0 \"rClients.end() != rPos && \\\"AccessibleEventNotifier::implLookupClient: invalid client id \\\" \\\"(did you register your client?)!\\\"\", file=0x7f0f28b37478 \".../comphelper/source/misc/accessibleeventnotifier.cxx\", line=140, function=0x7f0f28b375b0 \"bool {anonymous}::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::iterator&)\") at ./assert/assert.c:101\n"
    >~"#6  0x00007f0f28913886 in (anonymous namespace)::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, 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> > > >::iterator&) (nClient=218, rPos=...) at .../comphelper/source/misc/accessibleeventnotifier.cxx:140\n"

    >~"#7  0x00007f0f28913b9a in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (_nClient=218, _rxEventSource=uno::Reference to (accessibility::AccessibleBrowseBoxHeaderCell *) 0x55fb25c8b3d0) at .../comphelper/source/misc/accessibleeventnotifier.cxx:185\n"
    >~"#8  0x00007f0eef073244 in accessibility::AccessibleBrowseBoxBase::disposing() (this=0x55fb25c8b3d0) at .../accessibility/source/extended/AccessibleBrowseBoxBase.cxx:113\n"
    >~"#9  0x00007f0f28474aeb in cppu::WeakComponentImplHelperBase::dispose() (this=0x55fb25c8b3d0) at .../cppuhelper/source/implbase.cxx:104\n"
    >~"#10 0x00007f0eef0712c2 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XFocusListener, com::sun::star::lang::XServiceInfo>::dispose() (this=0x55fb25c8b3d0) at .../include/cppuhelper/compbase.hxx:90\n"
    >~"#11 0x00007f0f28474834 in cppu::WeakComponentImplHelperBase::release() (this=0x55fb25c8b3d0) at .../cppuhelper/source/implbase.cxx:79\n"
    >~"#12 0x00007f0eef072124 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XFocusListener, com::sun::star::lang::XServiceInfo>::release() (this=0x55fb25c8b3d0) at .../include/cppuhelper/compbase.hxx:86\n"
    >~"#13 0x00007f0eef07544a in accessibility::BrowseBoxAccessibleElement::release() (this=0x55fb25c8b3d0) at .../accessibility/source/extended/AccessibleBrowseBoxBase.cxx:518\n"
    >~"#14 0x00007f0f15842747 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>::~Reference() (this=0x7f0f0c0246e0, __in_chrg=<optimized out>) at .../include/com/sun/star/uno/Reference.hxx:114\n"

    >~"#15 0x00007f0f15862b9f in QtAccessibleWidget::~QtAccessibleWidget() (this=0x7f0f0c0246a0, __in_chrg=<optimized out>) at .../vcl/inc/qt6/../qt5/QtAccessibleWidget.hxx:39\n"
    >~"#16 0x00007f0f15862c76 in QtAccessibleWidget::~QtAccessibleWidget() (this=0x7f0f0c0246a0, __in_chrg=<optimized out>) at .../vcl/inc/qt6/../qt5/QtAccessibleWidget.hxx:39\n"
    >~"#17 0x00007f0f146ca101 in QAccessibleCache::deleteInterface(unsigned int, QObject*) (this=0x55fb1ef073e0, id=2147483876, obj=0x55fb25c8abf0) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:173\n"
    >~"#18 0x00007f0f146c9712 in QAccessibleCache::~QAccessibleCache() (this=0x55fb1ef073e0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:31\n"
    >~"#19 0x00007f0f146c9798 in QAccessibleCache::~QAccessibleCache() (this=0x55fb1ef073e0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:32\n"
    >~"#20 0x00007f0f146c967e in cleanupAccessibleCache() () at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:24\n"
    >~"#21 0x00007f0f14fa22f7 in qt_call_post_routines() () at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:325\n"

    >~"#22 0x00007f0f13599da0 in QApplication::~QApplication() (this=0x55fb1dfd77b0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:663\n"
    >~"#23 0x00007f0f1359a09e in QApplication::~QApplication() (this=0x55fb1dfd77b0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:717\n"
    >~"#24 0x00007f0f158ce2c4 in std::default_delete<QApplication>::operator()(QApplication*) const (this=0x55fb1e07b220, __ptr=0x55fb1dfd77b0) at /usr/include/c++/13/bits/unique_ptr.h:99\n"
    >~"#25 0x00007f0f158ce70c in std::__uniq_ptr_impl<QApplication, std::default_delete<QApplication> >::reset(QApplication*) (this=0x55fb1e07b220, __p=0x0) at /usr/include/c++/13/bits/unique_ptr.h:211\n"
    >~"#26 0x00007f0f158cc643 in std::unique_ptr<QApplication, std::default_delete<QApplication> >::reset(QApplication*) (this=0x55fb1e07b220, __p=0x0) at /usr/include/c++/13/bits/unique_ptr.h:509\n"

    >~"#27 0x00007f0f158c506b in QtInstance::~QtInstance() (this=0x55fb1e07b090, __in_chrg=<optimized out>) at .../vcl/qt6/../qt5/QtInstance.cxx:273\n"
    >~"#28 0x00007f0f158c5142 in QtInstance::~QtInstance() (this=0x55fb1e07b090, __in_chrg=<optimized out>) at .../vcl/qt6/../qt5/QtInstance.cxx:274\n"

    >~"#29 0x00007f0f202615d9 in DestroySalInstance(SalInstance*) (pInst=0x55fb1e07b0a0) at .../vcl/source/app/salplug.cxx:389\n"
    >~"#30 0x00007f0f203401ee in DeInitVCL() () at .../vcl/source/app/svmain.cxx:600\n"
    >~"#31 0x00007f0f2033e9bf in ImplSVMain() () at .../vcl/source/app/svmain.cxx:229\n"
    >~"#32 0x00007f0f2033ea1b in SVMain() () at .../vcl/source/app/svmain.cxx:236\n"
    >~"#33 0x00007f0f2989f6ed in soffice_main() () at .../desktop/source/app/sofficemain.cxx:94\n"
    >~"#34 0x000055fb1c8769d4 in sal_main () at .../desktop/source/app/main.c:51\n"
    >~"#35 0x000055fb1c8769ba in main (argc=3, argv=0x7fffd6677498) at .../desktop/source/app/main.c:49\n"

Change-Id: Ic5ba4f75cbeac3955417ca54c189b262289bfc79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156259
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 978cce0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156226
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request Sep 1, 2023
These QWidget methods need to be called
in the main thread.

Otherwise, opening the Update dialog
("Help" -> "Check for Updates", enabled
by `--enable-online-update` autogen switch)
triggers asserts like the one below with
a self-compiled Qt 6 development build
(qtbase dev branch as of
c802a9e987c9e38c01580f467eab92a651b3e033).

    ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff780160e0. Receiver '' (of type 'QtWidget') was created in thread 0x0x5555555fcd30", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 537

    Thread 40 "InitUpdateCheck" received signal SIGABRT, Aborted.
    [Switching to Thread 0x7fff7ffff6c0 (LWP 1516868)]
    __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  0x00007ffff78a815f 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  0x00007fffe32eb45a in qAbort() () at /home/michi/development/git/qt5/qtbase/src/corelib/global/qglobal.cpp:161
    #5  0x00007fffe32f9ee5 in qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) (context=..., message=...) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:2057
    #6  0x00007fffe32f620c in QMessageLogger::fatal(char const*, ...) const (this=0x7fff7fffb980, msg=0x7fffe37fd9a0 "ASSERT failure in %s: \"%s\", file %s, line %d")
        at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:938
    #7  0x00007fffe32e9d54 in qt_assert_x(char const*, char const*, char const*, int)
        (where=0x7fffe38131e9 "QCoreApplication::sendEvent", what=0x7fff78180110 "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff780160e0. Receiver '' (of type 'QtWidget') was created in thread 0x0x5555555fcd30", file=0x7fffe3812e18 "/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp", line=537) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:77
    #8  0x00007fffe33a4d74 in QCoreApplicationPrivate::checkReceiverThread(QObject*) (receiver=0x55555d27d5d0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:537
    #9  0x00007fffe19a3a81 in QApplication::notify(QObject*, QEvent*) (this=0x5555555fcb80, receiver=0x55555d27d5d0, e=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2584
    #10 0x00007fffe33a5ed0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55555d27d5d0, event=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1125
    #11 0x00007fffe33a6991 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55555d27d5d0, event=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1559
    #12 0x00007fffe1a279b4 in QWidget::setWindowTitle(QString const&) (this=0x55555d27d5d0, title=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:6119
    #13 0x00007fffe3c9d4c4 in QtFrame::SetTitle(rtl::OUString const&) (this=0x555555619d20, rTitle="Check for Updates") at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:365
    #14 0x00007fffedd98d44 in vcl::Window::SetText(rtl::OUString const&) (this=0x7fff7803cd90, rStr="Check for Updates") at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:3042
    #15 0x00007fffedd311c9 in SystemWindow::SetText(rtl::OUString const&) (this=0x7fff7803cd90, rStr="Check for Updates") at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1048
    #16 0x00007ffff048bd6b in VCLXWindow::setProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7804ac00, PropertyName="Title", Value=uno::Any("string": "Check for Updates"))
        at /home/michi/development/git/libreoffice/toolkit/source/awt/vclxwindow.cxx:1515
    #17 0x00007ffff03e486d in VCLXContainer::setProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7804ac00, PropertyName="Title", Value=uno::Any("string": "Check for Updates"))
        at /home/michi/development/git/libreoffice/toolkit/source/awt/vclxcontainer.cxx:260
    #18 0x00007ffff04dfa2c in VCLXDialog::setProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7804ac00, PropertyName="Title", Value=uno::Any("string": "Check for Updates"))
        at /home/michi/development/git/libreoffice/toolkit/source/awt/vclxwindows.cxx:2364
    #19 0x00007ffff06a89b7 in UnoControl::ImplSetPeerProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7803b4f0, rPropName="Title", rVal=uno::Any("string": "Check for Updates"))
        at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:288
    #20 0x00007ffff06aa701 in UnoControl::ImplModelPropertiesChanged(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...})
        at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:649
    #21 0x00007ffff0531ae9 in ControlContainerBase::ImplModelPropertiesChanged(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...})
        at /home/michi/development/git/libreoffice/toolkit/source/controls/controlmodelcontainerbase.cxx:1600
    #22 0x00007ffff0575a25 in UnoDialogControl::ImplModelPropertiesChanged(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...})
        at /home/michi/development/git/libreoffice/toolkit/source/controls/dialogcontrol.cxx:651
    #23 0x00007ffff06a95f3 in UnoControl::propertiesChange(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> const&) (this=0x7fff7803b4f0, rEvents=uno::Sequence of length 51 = {...})
        at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:431
    #24 0x00007ffff66bc4ee in cppu::OPropertySetHelper::firePropertiesChangeEvent(com::sun::star::uno::Sequence<rtl::OUString> const&, com::sun::star::uno::Reference<com::sun::star::beans::XPropertiesChangeListener> const&)
        (this=0x7fff78006170, rPropertyNames=uno::Sequence of length 51 = {...}, rListener=uno::Reference to (UnoDialogControl *) 0x7fff7803b540) at /home/michi/development/git/libreoffice/cppuhelper/source/propshlp.cxx:961
    #25 0x00007ffff06a8c6b in UnoControl::updateFromModel() (this=0x7fff7803b4f0) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:320
    #26 0x00007ffff06aefc9 in UnoControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&)
        (this=0x7fff7803b4f0, rxToolkit=empty uno::Reference, rParentPeer=empty uno::Reference) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrol.cxx:1325
    #27 0x00007ffff06c9905 in UnoControlContainer::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&)
        (this=0x7fff7803b4f0, rxToolkit=empty uno::Reference, rParent=empty uno::Reference) at /home/michi/development/git/libreoffice/toolkit/source/controls/unocontrolcontainer.cxx:727
    #28 0x00007ffff057336d in UnoDialogControl::createPeer(com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> const&)
        (this=0x7fff7803b4f0, rxToolkit=empty uno::Reference, rParentPeer=empty uno::Reference) at /home/michi/development/git/libreoffice/toolkit/source/controls/dialogcontrol.cxx:358
    #29 0x00007fffb7264e62 in UpdateHandler::createDialog() (this=0x7fff78003aa0) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatehdl.cxx:1232
    #30 0x00007fffb725b0e1 in UpdateHandler::setVisible(bool) (this=0x7fff78003aa0, bVisible=true) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatehdl.cxx:188
    #31 0x00007fffb7235887 in UpdateCheck::showDialog(bool) (this=0x7fff78000b90, forceCheck=true) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatecheck.cxx:1171
    #32 0x00007fffb7255c5e in (anonymous namespace)::InitUpdateCheckJobThread::run() (this=0x55555d192690) at /home/michi/development/git/libreoffice/extensions/source/update/check/updatecheckjob.cxx:148
    #33 0x00007fffb723a74a in osl::threadFunc(void*) (param=0x55555d192690) at /home/michi/development/git/libreoffice/include/osl/thread.hxx:189
    #34 0x00007ffff7f3f693 in osl_thread_start_Impl(void*) (pData=0x55555d1a68b0) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:237
    #35 0x00007ffff78a63ec in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
    #36 0x00007ffff7926a1c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Change-Id: I6ccdee00fe26619f201459ebbe6c4d8cf8b57b45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156426
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Sep 6, 2023
When disposing the `SvHeaderTabListBox`, also dispose
the a11y objects for its header cells and clear
the vector.

This fixes a crash on exit that could e.g. be triggered
as follows when using the qt6 VCL plugin on Linux:

1) start accerciser
2) start Writer with qt6 VCL plugin
3) press Alt+F12 to open the options dialog
4) enable "LibreOfficeDev" -> "Advanced" (i.e. Java Options dialog)
5) in Accerciser, click through LO a11y hierarchy, in particular on all of the cells of the JRE table
6) close the dialog and LO

Backtrace:

    ~"#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44\n"
    >~"#1  0x00007f0f296a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78\n"
    >~"#2  0x00007f0f2965a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26\n"
    >~"#3  0x00007f0f296444b2 in __GI_abort () at ./stdlib/abort.c:79\n"
    >~"#4  0x00007f0f296443d5 in __assert_fail_base (fmt=0x7f0f297b8dc8 \"%s%s%s:%u: %s%sAssertion `%s' failed.\\n%n\", assertion=assertion@entry=0x7f0f28b376a0 \"rClients.end() != rPos && \\\"AccessibleEventNotifier::implLookupClient: invalid client id \\\" \\\"(did you register your client?)!\\\"\", file=file@entry=0x7f0f28b37478 \".../comphelper/source/misc/accessibleeventnotifier.cxx\", line=line@entry=140, function=function@entry=0x7f0f28b375b0 \"bool {anonymous}::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::iterator&)\") at ./assert/assert.c:92\n"
    >~"#5  0x00007f0f296533a2 in __assert_fail (assertion=0x7f0f28b376a0 \"rClients.end() != rPos && \\\"AccessibleEventNotifier::implLookupClient: invalid client id \\\" \\\"(did you register your client?)!\\\"\", file=0x7f0f28b37478 \".../comphelper/source/misc/accessibleeventnotifier.cxx\", line=140, function=0x7f0f28b375b0 \"bool {anonymous}::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, std::__debug::unordered_map<unsigned int, comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> >::iterator&)\") at ./assert/assert.c:101\n"
    >~"#6  0x00007f0f28913886 in (anonymous namespace)::implLookupClient(comphelper::AccessibleEventNotifier::TClientId, 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> > > >::iterator&) (nClient=218, rPos=...) at .../comphelper/source/misc/accessibleeventnotifier.cxx:140\n"

    >~"#7  0x00007f0f28913b9a in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(unsigned int, com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (_nClient=218, _rxEventSource=uno::Reference to (accessibility::AccessibleBrowseBoxHeaderCell *) 0x55fb25c8b3d0) at .../comphelper/source/misc/accessibleeventnotifier.cxx:185\n"
    >~"#8  0x00007f0eef073244 in accessibility::AccessibleBrowseBoxBase::disposing() (this=0x55fb25c8b3d0) at .../accessibility/source/extended/AccessibleBrowseBoxBase.cxx:113\n"
    >~"#9  0x00007f0f28474aeb in cppu::WeakComponentImplHelperBase::dispose() (this=0x55fb25c8b3d0) at .../cppuhelper/source/implbase.cxx:104\n"
    >~"#10 0x00007f0eef0712c2 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XFocusListener, com::sun::star::lang::XServiceInfo>::dispose() (this=0x55fb25c8b3d0) at .../include/cppuhelper/compbase.hxx:90\n"
    >~"#11 0x00007f0f28474834 in cppu::WeakComponentImplHelperBase::release() (this=0x55fb25c8b3d0) at .../cppuhelper/source/implbase.cxx:79\n"
    >~"#12 0x00007f0eef072124 in cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::awt::XFocusListener, com::sun::star::lang::XServiceInfo>::release() (this=0x55fb25c8b3d0) at .../include/cppuhelper/compbase.hxx:86\n"
    >~"#13 0x00007f0eef07544a in accessibility::BrowseBoxAccessibleElement::release() (this=0x55fb25c8b3d0) at .../accessibility/source/extended/AccessibleBrowseBoxBase.cxx:518\n"
    >~"#14 0x00007f0f15842747 in com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>::~Reference() (this=0x7f0f0c0246e0, __in_chrg=<optimized out>) at .../include/com/sun/star/uno/Reference.hxx:114\n"

    >~"#15 0x00007f0f15862b9f in QtAccessibleWidget::~QtAccessibleWidget() (this=0x7f0f0c0246a0, __in_chrg=<optimized out>) at .../vcl/inc/qt6/../qt5/QtAccessibleWidget.hxx:39\n"
    >~"#16 0x00007f0f15862c76 in QtAccessibleWidget::~QtAccessibleWidget() (this=0x7f0f0c0246a0, __in_chrg=<optimized out>) at .../vcl/inc/qt6/../qt5/QtAccessibleWidget.hxx:39\n"
    >~"#17 0x00007f0f146ca101 in QAccessibleCache::deleteInterface(unsigned int, QObject*) (this=0x55fb1ef073e0, id=2147483876, obj=0x55fb25c8abf0) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:173\n"
    >~"#18 0x00007f0f146c9712 in QAccessibleCache::~QAccessibleCache() (this=0x55fb1ef073e0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:31\n"
    >~"#19 0x00007f0f146c9798 in QAccessibleCache::~QAccessibleCache() (this=0x55fb1ef073e0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:32\n"
    >~"#20 0x00007f0f146c967e in cleanupAccessibleCache() () at /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessiblecache.cpp:24\n"
    >~"#21 0x00007f0f14fa22f7 in qt_call_post_routines() () at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:325\n"

    >~"#22 0x00007f0f13599da0 in QApplication::~QApplication() (this=0x55fb1dfd77b0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:663\n"
    >~"#23 0x00007f0f1359a09e in QApplication::~QApplication() (this=0x55fb1dfd77b0, __in_chrg=<optimized out>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:717\n"
    >~"#24 0x00007f0f158ce2c4 in std::default_delete<QApplication>::operator()(QApplication*) const (this=0x55fb1e07b220, __ptr=0x55fb1dfd77b0) at /usr/include/c++/13/bits/unique_ptr.h:99\n"
    >~"#25 0x00007f0f158ce70c in std::__uniq_ptr_impl<QApplication, std::default_delete<QApplication> >::reset(QApplication*) (this=0x55fb1e07b220, __p=0x0) at /usr/include/c++/13/bits/unique_ptr.h:211\n"
    >~"#26 0x00007f0f158cc643 in std::unique_ptr<QApplication, std::default_delete<QApplication> >::reset(QApplication*) (this=0x55fb1e07b220, __p=0x0) at /usr/include/c++/13/bits/unique_ptr.h:509\n"

    >~"#27 0x00007f0f158c506b in QtInstance::~QtInstance() (this=0x55fb1e07b090, __in_chrg=<optimized out>) at .../vcl/qt6/../qt5/QtInstance.cxx:273\n"
    >~"#28 0x00007f0f158c5142 in QtInstance::~QtInstance() (this=0x55fb1e07b090, __in_chrg=<optimized out>) at .../vcl/qt6/../qt5/QtInstance.cxx:274\n"

    >~"#29 0x00007f0f202615d9 in DestroySalInstance(SalInstance*) (pInst=0x55fb1e07b0a0) at .../vcl/source/app/salplug.cxx:389\n"
    >~"#30 0x00007f0f203401ee in DeInitVCL() () at .../vcl/source/app/svmain.cxx:600\n"
    >~"#31 0x00007f0f2033e9bf in ImplSVMain() () at .../vcl/source/app/svmain.cxx:229\n"
    >~"#32 0x00007f0f2033ea1b in SVMain() () at .../vcl/source/app/svmain.cxx:236\n"
    >~"#33 0x00007f0f2989f6ed in soffice_main() () at .../desktop/source/app/sofficemain.cxx:94\n"
    >~"#34 0x000055fb1c8769d4 in sal_main () at .../desktop/source/app/main.c:51\n"
    >~"#35 0x000055fb1c8769ba in main (argc=3, argv=0x7fffd6677498) at .../desktop/source/app/main.c:49\n"

Change-Id: Ic5ba4f75cbeac3955417ca54c189b262289bfc79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156259
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 978cce0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156226
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit f50616ab80a3895f7677fdcfe8d820affbff8de8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156388
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request Sep 18, 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 <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Sep 19, 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 <m.weghorn@posteo.de>
(cherry picked from commit 2632ce875f9a9c3b0a7861112dbfc48fe17bc2a5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156961
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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 <sbergman@redhat.com>
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 <mike.kaganski@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Dec 18, 2023
Regression from commit b8521d9
(tdf#157263 sw floattable: prefer join over split after moving fwd,
2023-09-25), enabling Options -> Writer -> Formatting Aids -> Hidden
Characters, then opening the bugdoc, finally Toggle Print Preview on the
toolbar resulted in a crash.

We have a memory corruption here:

	==11968==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f0000734e0 at pc 0x7f473822d2ee bp 0x7fffdadd3660 sp 0x7fffdadd3658
	READ of size 8 at 0x60f0000734e0 thread T0
	    #0 0x7f473822d2ed in rtl::Reference<FmXFormShell>::operator->() const /include/rtl/ref.hxx:216:9
	    #1 0x7f473821feeb in FmFormShell::IsActiveControl() const /svx/source/form/fmshell.cxx:1227:12
	    #2 0x7f46dad4d52a in SwView::SelectShell() /sw/source/uibase/uiview/view.cxx:296:40
	    #3 0x7f46dad496a6 in SwView::AttrChangedNotify(LinkParamNone*) /sw/source/uibase/uiview/view.cxx:572:13
	...
	    #32 0x7f4748944cda in SfxViewFrame::SwitchToViewShell_Impl(unsigned short, bool) /sfx2/source/view/viewfrm.cxx:2552:32
	    #33 0x7f47488f4e3b in SfxViewFrame::ExecView_Impl(SfxRequest&) /sfx2/source/view/viewfrm.cxx:2637:29
	freed by thread T0 here:
	    #0 0x5568ff2f9a7b in operator delete(void*, unsigned long) /home/abuild/rpmbuild/BUILD/llvm-15.0.7.src/build/../projects/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
	    #1 0x7f4738214346 in FmFormShell::~FmFormShell() /svx/source/form/fmshell.cxx:181:1
	    #2 0x7f4746b04b9d in SfxDispatcher::FlushImpl() /sfx2/source/control/dispatch.cxx:1412:13
	    #3 0x7f4746aff767 in SfxDispatcher::Flush() /sfx2/source/control/dispatch.cxx:157:26
	    #4 0x7f47489100dc in SfxViewFrame::PopShellAndSubShells_Impl(SfxViewShell&) /sfx2/source/view/viewfrm.cxx:1100:24
	    #5 0x7f47489441a3 in SfxViewFrame::SwitchToViewShell_Impl(unsigned short, bool) /sfx2/source/view/viewfrm.cxx:2538:13
	    #6 0x7f47488f4e3b in SfxViewFrame::ExecView_Impl(SfxRequest&) /sfx2/source/view/viewfrm.cxx:2637:29

I.e. a new SwPagePreview replaces the old SwView, but the order is that
SfxViewFrame::SwitchToViewShell_Impl() starts with deleting the
SfxShells of the old SwView in PopShellAndSubShells_Impl(), then it
creates the new shell, finally deletes the old shell. Given that the new
shell hides hidden characters and the old shell did not, this triggers a
size notification for the half-deleted old shell and we crash.

Seeing that SwView::AttrChangedNotify() already had code to delay the
selection of an SfxShell in the old SwView, fix the problem by
introducing a new flag that allows not selecting an SfxShell at all if
the old view is known to be deleted in the near future anyway.

An alternative would be to make sure that all relevant pointers are
maintained using an SfxBroadcaster / SfxListener protocol, but after
fixing some 4 of them and that's still not enough, probably it's better
to handle this at a higher level. It's also a bit unclear how this
"worked" in the past; looks like the old view didn't get the size change
notification by accident.

Change-Id: I423ff946f8235848cc3a870bc52fcf88a721fd2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160925
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
tdf-gerrit pushed a commit that referenced this pull request Jan 29, 2024
In `AccessibleShape::disposing`, call the same method
of the base class, i.e. `AccessibleContextBase::disposing`,
not `AccessibleContextBase::dispose`.

The code was moved from `AccessibleShape::dispose` to
`AccessibleShape::disposing` in

    commit f11b151
    Date:   Tue Apr 30 13:30:10 2002 +0000

        #95585# Moved code from dispose to disposing().

and it seems likely that adjusting the base class method to call
was just forgotten/missed.

This resulted in the accessible getting disposed without listeners
getting notified (since `AccessibleContextBase::disposing` takes
care of that).

This resulted in a crash for the following scenario with the qt6
VCL plugin when the Orca screen reader is running:

1) start LO Writer
2) click on the "Basic shapes" toolbar button
3) click + drag to insert a shape into the document
4) click somewhere else

Backtrace is below.
`AtSpiAdaptor::handleMessage` (frame #12 in the bt) checks
whether the accessible is valid and returns early otherwise.
But since listeners were not notified when the object got disposed,
`QtAccessibleEventListener::disposing` wasn't called, which would
have taken care of invalidating the `QtAccessibleWidget`, in which
case this early return would have happened instead of the crash.

This behaves as expected now with this commit in place.

stderr output of the crash:

    terminate called after throwing an instance of 'com::sun::star::lang::DisposedException'

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.
    (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  0x00007f5bc1ca815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007f5bc1c5a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007f5bc1c444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007f5bc18a09eb in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007f5bc18affca in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007f5bc18b0035 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
    #7  0x00007f5bc18b0288 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
    #8  0x00007f5bc02b4550 in accessibility::AccessibleContextBase::ThrowIfDisposed() (this=0x55a6fc7e7da0) at .../libreoffice/editeng/source/accessibility/AccessibleContextBase.cxx:494
    #9  0x00007f5bbcf7d54e in accessibility::AccessibleShape::getAccessibleName() (this=0x55a6fc7e7da0) at .../libreoffice/svx/source/accessibility/AccessibleShape.cxx:280
    #10 0x00007f5bada62107 in QtAccessibleWidget::text(QAccessible::Text) const (this=0x55a6fad4fe20, text=QAccessible::Name) at .../libreoffice/vcl/qt6/../qt5/QtAccessibleWidget.cxx:362
    #11 0x00007f5bac5552d2 in AtSpiAdaptor::accessibleInterface(QAccessibleInterface*, QString const&, QDBusMessage const&, QDBusConnection const&) (this=0x55a6f769bce0, interface=0x55a6fad4fe20, function=..., message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1545
    #12 0x00007f5bac553cce in AtSpiAdaptor::handleMessage(QDBusMessage const&, QDBusConnection const&) (this=0x55a6f769bce0, message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1432
    #13 0x00007f5baaa88943 in QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, QDBusMessage const&, int) (this=0x7f5ba4010f30, node=..., msg=..., pathStartPos=27)
        at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1448
    #14 0x00007f5baaa89628 in QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x7f5ba4026980) at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1604
    #15 0x00007f5bad044013 in QObject::event(QEvent*) (this=0x55a6f769bce0, e=0x7f5ba4026980) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:1447
    #16 0x00007f5bab1a6986 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x55a6f631c3e0, receiver=0x55a6f769bce0, e=0x7f5ba4026980) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3298
    #17 0x00007f5bab1a6797 in QApplication::notify(QObject*, QEvent*) (this=0x55a6f63bb840, receiver=0x55a6f769bce0, e=0x7f5ba4026980) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3249
    #18 0x00007f5bacfb0212 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55a6f769bce0, event=0x7f5ba4026980) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1138
    #19 0x00007f5bacfb0dbb in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55a6f769bce0, event=0x7f5ba4026980) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1581
    #20 0x00007f5bacfb2474 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x55a6f6337df0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1936
    #21 0x00007f5bacfb160e in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=0x0, event_type=0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1770
    #22 0x00007f5bad43441c in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55a6f642f710) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:244
    #23 0x00007f5bb47111f4 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #24 0x00007f5bb4714317 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #25 0x00007f5bb4714930 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #26 0x00007f5bad434cb1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55a6f6435dc0, flags=...) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:394
    #27 0x00007f5baa929e18 in QXcbGlibEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55a6f6435dc0, flags=...) at .../qt5/qtbase/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:96
    #28 0x00007f5badad8bea in QtInstance::ImplYield(bool, bool) (this=0x55a6f6442080, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:424
    #29 0x00007f5badad8d13 in QtInstance::DoYield(bool, bool) (this=0x55a6f6442080, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:435
    #30 0x00007f5bb8734af6 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:386
    #31 0x00007f5bb8735894 in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:470
    #32 0x00007f5bb87347e9 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:364
    #33 0x00007f5bc1e36e66 in desktop::Desktop::Main() (this=0x7ffc62160570) at .../libreoffice/desktop/source/app/app.cxx:1614
    #34 0x00007f5bb8753ca0 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229
    #35 0x00007f5bb8753fb5 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #36 0x00007f5bc1ea4101 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #37 0x000055a6f46e19d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #38 0x000055a6f46e19ba in main (argc=2, argv=0x7ffc62160798) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: Iae8a9ff61df99094b4cd73da895d1f6ac850c0c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162493
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 77874b76c50d704b26543175375dcfa65c4fd620)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162537
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
(cherry picked from commit f4fa41c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162815
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
(cherry picked from commit f4fa41c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162816
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
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 <m.weghorn@posteo.de>
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 <m.weghorn@posteo.de>
(cherry picked from commit cb9513c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163179
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Feb 16, 2024
Hold the SolarMutex instead of of using a custom mutex,
since `SwAccessibleMap` methods that get called require
the SolarMutex to be held.

Fixes a crash/assert when interacting with Writer comments
using the mouse while the Orca screen reader is running
when using the qt6 VCL plugin.

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.
    (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  0x00007f0a462a81cf in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007f0a4625a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007f0a462444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007f0a462443d5 in __assert_fail_base
        (fmt=0x7f0a463b8dc8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f0a3d775838 "ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex not owned!\"", file=file@entry=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", line=line@entry=35, function=function@entry=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at ./assert/assert.c:92
    #5  0x00007f0a462533a2 in __assert_fail
        (assertion=0x7f0a3d775838 "ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex not owned!\"", file=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", line=35, function=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at ./assert/assert.c:101
    #6  0x00007f0a3ca733b4 in ImplDbgTestSolarMutex() () at .../libreoffice/vcl/source/app/dbggui.cxx:35
    #7  0x00007f0a452ccfbb in DbgTestSolarMutex() () at .../libreoffice/tools/source/debug/debug.cxx:54
    #8  0x00007f09f8fd3903 in SwAccessibleMap::GetContext(SwFrame const*, bool) (this=0x55fa8fd89930, pFrame=0x55fa8ecddb00, bCreate=false) at .../libreoffice/sw/source/core/access/accmap.cxx:1777
    #9  0x00007f09f906f684 in sw::sidebarwindows::(anonymous namespace)::SidebarWinAccessibleContext::getAccessibleParent() (this=0x55fa8f83e600) at .../libreoffice/sw/source/uibase/docvw/SidebarWinAcc.cxx:65
    #10 0x00007f0a31e6244c in QtAccessibleWidget::parent() const (this=0x7f0a280b6150) at .../libreoffice/vcl/qt6/../qt5/QtAccessibleWidget.cxx:322
    #11 0x00007f0a3095b51a in AtSpiAdaptor::accessibleInterface(QAccessibleInterface*, QString const&, QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, interface=0x7f0a280b6150, function=..., message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1592
    #12 0x00007f0a30959934 in AtSpiAdaptor::handleMessage(QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1460
    #13 0x00007f0a2ee88ad3 in QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, QDBusMessage const&, int) (this=0x7f0a28010b60, node=..., msg=..., pathStartPos=27)
        at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1448
    #14 0x00007f0a2ee897b8 in QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x7f0a280b8400) at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1604
    #15 0x00007f0a31445095 in QObject::event(QEvent*) (this=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:1447
    #16 0x00007f0a2f5a696c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x55fa872f63e0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3298
    #17 0x00007f0a2f5a677d in QApplication::notify(QObject*, QEvent*) (this=0x55fa873956b0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3249
    #18 0x00007f0a313b1162 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1138
    #19 0x00007f0a313b1d0b in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1581
    #20 0x00007f0a313b33c4 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x55fa87311df0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1936
    #21 0x00007f0a313b255e in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=0x0, event_type=0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1770
    #22 0x00007f0a318384ac in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55fa873b8c20) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:244
    #23 0x00007f0a38d111f4 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #24 0x00007f0a38d14317 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #25 0x00007f0a38d14930 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #26 0x00007f0a31838d41 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55fa873987a0, flags=...) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:394
    #27 0x00007f0a30b5c418 in QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55fa873987a0, flags=...) at .../qt5/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:87
    #28 0x00007f0a31ed9a40 in QtInstance::ImplYield(bool, bool) (this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:453
    #29 0x00007f0a31ed9b69 in QtInstance::DoYield(bool, bool) (this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464
    #30 0x00007f0a3cb39434 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390
    #31 0x00007f0a3cb3a1d2 in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:474
    #32 0x00007f0a3cb39127 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:368
    #33 0x00007f0a46437216 in desktop::Desktop::Main() (this=0x7ffd0478dce0) at .../libreoffice/desktop/source/app/app.cxx:1614
    #34 0x00007f0a3cb585f6 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229
    #35 0x00007f0a3cb5890b in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #36 0x00007f0a464a4367 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #37 0x000055fa860a09d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #38 0x000055fa860a09ba in main (argc=3, argv=0x7ffd0478df08) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: If6df884fe94b2aac74be1b9fb13356bf765119d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163379
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Feb 16, 2024
Hold the SolarMutex instead of of using a custom mutex,
since `SwAccessibleMap` methods that get called require
the SolarMutex to be held.

Fixes a crash/assert when interacting with Writer comments
using the mouse while the Orca screen reader is running
when using the qt6 VCL plugin.

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.
    (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  0x00007f0a462a81cf in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007f0a4625a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007f0a462444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007f0a462443d5 in __assert_fail_base
        (fmt=0x7f0a463b8dc8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f0a3d775838 "ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex not owned!\"", file=file@entry=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", line=line@entry=35, function=function@entry=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at ./assert/assert.c:92
    #5  0x00007f0a462533a2 in __assert_fail
        (assertion=0x7f0a3d775838 "ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex not owned!\"", file=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", line=35, function=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at ./assert/assert.c:101
    #6  0x00007f0a3ca733b4 in ImplDbgTestSolarMutex() () at .../libreoffice/vcl/source/app/dbggui.cxx:35
    #7  0x00007f0a452ccfbb in DbgTestSolarMutex() () at .../libreoffice/tools/source/debug/debug.cxx:54
    #8  0x00007f09f8fd3903 in SwAccessibleMap::GetContext(SwFrame const*, bool) (this=0x55fa8fd89930, pFrame=0x55fa8ecddb00, bCreate=false) at .../libreoffice/sw/source/core/access/accmap.cxx:1777
    #9  0x00007f09f906f684 in sw::sidebarwindows::(anonymous namespace)::SidebarWinAccessibleContext::getAccessibleParent() (this=0x55fa8f83e600) at .../libreoffice/sw/source/uibase/docvw/SidebarWinAcc.cxx:65
    #10 0x00007f0a31e6244c in QtAccessibleWidget::parent() const (this=0x7f0a280b6150) at .../libreoffice/vcl/qt6/../qt5/QtAccessibleWidget.cxx:322
    #11 0x00007f0a3095b51a in AtSpiAdaptor::accessibleInterface(QAccessibleInterface*, QString const&, QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, interface=0x7f0a280b6150, function=..., message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1592
    #12 0x00007f0a30959934 in AtSpiAdaptor::handleMessage(QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1460
    #13 0x00007f0a2ee88ad3 in QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, QDBusMessage const&, int) (this=0x7f0a28010b60, node=..., msg=..., pathStartPos=27)
        at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1448
    #14 0x00007f0a2ee897b8 in QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x7f0a280b8400) at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1604
    #15 0x00007f0a31445095 in QObject::event(QEvent*) (this=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:1447
    #16 0x00007f0a2f5a696c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x55fa872f63e0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3298
    #17 0x00007f0a2f5a677d in QApplication::notify(QObject*, QEvent*) (this=0x55fa873956b0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3249
    #18 0x00007f0a313b1162 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1138
    #19 0x00007f0a313b1d0b in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1581
    #20 0x00007f0a313b33c4 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x55fa87311df0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1936
    #21 0x00007f0a313b255e in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=0x0, event_type=0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1770
    #22 0x00007f0a318384ac in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55fa873b8c20) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:244
    #23 0x00007f0a38d111f4 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #24 0x00007f0a38d14317 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #25 0x00007f0a38d14930 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #26 0x00007f0a31838d41 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55fa873987a0, flags=...) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:394
    #27 0x00007f0a30b5c418 in QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55fa873987a0, flags=...) at .../qt5/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:87
    #28 0x00007f0a31ed9a40 in QtInstance::ImplYield(bool, bool) (this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:453
    #29 0x00007f0a31ed9b69 in QtInstance::DoYield(bool, bool) (this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464
    #30 0x00007f0a3cb39434 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390
    #31 0x00007f0a3cb3a1d2 in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:474
    #32 0x00007f0a3cb39127 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:368
    #33 0x00007f0a46437216 in desktop::Desktop::Main() (this=0x7ffd0478dce0) at .../libreoffice/desktop/source/app/app.cxx:1614
    #34 0x00007f0a3cb585f6 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229
    #35 0x00007f0a3cb5890b in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #36 0x00007f0a464a4367 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #37 0x000055fa860a09d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #38 0x000055fa860a09ba in main (argc=3, argv=0x7ffd0478df08) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: If6df884fe94b2aac74be1b9fb13356bf765119d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163379
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 512b09e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163404
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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 <m.weghorn@posteo.de>
(cherry picked from commit cb9513c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163179
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Feb 16, 2024
Hold the SolarMutex instead of of using a custom mutex,
since `SwAccessibleMap` methods that get called require
the SolarMutex to be held.

Fixes a crash/assert when interacting with Writer comments
using the mouse while the Orca screen reader is running
when using the qt6 VCL plugin.

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.
    (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  0x00007f0a462a81cf in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007f0a4625a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007f0a462444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007f0a462443d5 in __assert_fail_base
        (fmt=0x7f0a463b8dc8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f0a3d775838 "ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex not owned!\"", file=file@entry=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", line=line@entry=35, function=function@entry=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at ./assert/assert.c:92
    #5  0x00007f0a462533a2 in __assert_fail
        (assertion=0x7f0a3d775838 "ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex not owned!\"", file=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", line=35, function=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at ./assert/assert.c:101
    #6  0x00007f0a3ca733b4 in ImplDbgTestSolarMutex() () at .../libreoffice/vcl/source/app/dbggui.cxx:35
    #7  0x00007f0a452ccfbb in DbgTestSolarMutex() () at .../libreoffice/tools/source/debug/debug.cxx:54
    #8  0x00007f09f8fd3903 in SwAccessibleMap::GetContext(SwFrame const*, bool) (this=0x55fa8fd89930, pFrame=0x55fa8ecddb00, bCreate=false) at .../libreoffice/sw/source/core/access/accmap.cxx:1777
    #9  0x00007f09f906f684 in sw::sidebarwindows::(anonymous namespace)::SidebarWinAccessibleContext::getAccessibleParent() (this=0x55fa8f83e600) at .../libreoffice/sw/source/uibase/docvw/SidebarWinAcc.cxx:65
    #10 0x00007f0a31e6244c in QtAccessibleWidget::parent() const (this=0x7f0a280b6150) at .../libreoffice/vcl/qt6/../qt5/QtAccessibleWidget.cxx:322
    #11 0x00007f0a3095b51a in AtSpiAdaptor::accessibleInterface(QAccessibleInterface*, QString const&, QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, interface=0x7f0a280b6150, function=..., message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1592
    #12 0x00007f0a30959934 in AtSpiAdaptor::handleMessage(QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, message=..., connection=...)
        at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1460
    #13 0x00007f0a2ee88ad3 in QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, QDBusMessage const&, int) (this=0x7f0a28010b60, node=..., msg=..., pathStartPos=27)
        at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1448
    #14 0x00007f0a2ee897b8 in QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x7f0a280b8400) at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1604
    #15 0x00007f0a31445095 in QObject::event(QEvent*) (this=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:1447
    #16 0x00007f0a2f5a696c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x55fa872f63e0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3298
    #17 0x00007f0a2f5a677d in QApplication::notify(QObject*, QEvent*) (this=0x55fa873956b0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at .../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3249
    #18 0x00007f0a313b1162 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1138
    #19 0x00007f0a313b1d0b in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1581
    #20 0x00007f0a313b33c4 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x55fa87311df0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1936
    #21 0x00007f0a313b255e in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=0x0, event_type=0) at .../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1770
    #22 0x00007f0a318384ac in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55fa873b8c20) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:244
    #23 0x00007f0a38d111f4 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #24 0x00007f0a38d14317 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #25 0x00007f0a38d14930 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #26 0x00007f0a31838d41 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55fa873987a0, flags=...) at .../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:394
    #27 0x00007f0a30b5c418 in QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55fa873987a0, flags=...) at .../qt5/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:87
    #28 0x00007f0a31ed9a40 in QtInstance::ImplYield(bool, bool) (this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:453
    #29 0x00007f0a31ed9b69 in QtInstance::DoYield(bool, bool) (this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at .../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464
    #30 0x00007f0a3cb39434 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390
    #31 0x00007f0a3cb3a1d2 in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:474
    #32 0x00007f0a3cb39127 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:368
    #33 0x00007f0a46437216 in desktop::Desktop::Main() (this=0x7ffd0478dce0) at .../libreoffice/desktop/source/app/app.cxx:1614
    #34 0x00007f0a3cb585f6 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:229
    #35 0x00007f0a3cb5890b in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:261
    #36 0x00007f0a464a4367 in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:94
    #37 0x000055fa860a09d4 in sal_main () at .../libreoffice/desktop/source/app/main.c:51
    #38 0x000055fa860a09ba in main (argc=3, argv=0x7ffd0478df08) at .../libreoffice/desktop/source/app/main.c:49

Change-Id: If6df884fe94b2aac74be1b9fb13356bf765119d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163379
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 512b09e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163404
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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 <m.weghorn@posteo.de>
(cherry picked from commit cb9513c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163179
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 0750cac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163184
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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 <stephan.bergmann@allotropia.de>
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 <stephan.bergmann@allotropia.de>
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 <m.weghorn@posteo.de>
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 <m.weghorn@posteo.de>
(cherry picked from commit 2ea7cdf9876ce2de61458982247ab6861e1aac2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163988
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
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 <m.weghorn@posteo.de>
(cherry picked from commit 2ea7cdf9876ce2de61458982247ab6861e1aac2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164113
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
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 <m.weghorn@posteo.de>
(cherry picked from commit 2ea7cdf9876ce2de61458982247ab6861e1aac2f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163988
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
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 <noel.grandin@collabora.co.uk>
tdf-gerrit pushed a commit that referenced this pull request Apr 2, 2024
(tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 2024-04-01).
As reported by Stephan in https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82:

 `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now fails with

  vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the range of representable values of type 'long'
   #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at vcl/source/gdi/sallayout.cxx:245:30
   #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString const&, int, int, int, unsigned long, KernArraySpan, std::span<unsigned char const, 18446744073709551615ul>, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1932:28
   #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32
   #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString const&, unsigned short) at starmath/source/rect.cxx:224:21
   #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at starmath/source/node.cxx:2122:18
   #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:1340:17
   #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:816:13
   #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:610:20
   #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:534:20
   #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13
   #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9
   #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21
   #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at starmath/source/document.cxx:552:5
   #13 in SmDocShell::SetText(rtl::OUString const&) at starmath/source/document.cxx:188:9
   #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/document.cxx:848:5
   #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/unomodel.cxx:1105:22
   #16 in writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30
   #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23
   #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at writerfilter/source/rtftok/rtftokenizer.cxx:114:37
   #19 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27
   #20 in (anonymous namespace)::RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at writerfilter/source/filter/RtfFilter.cxx:163:20
   #21 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2392:34
   #22 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:760:23
   #23 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36
   #24 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&) at sfx2/source/view/frmload.cxx:720:28
   #25 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37
   #26 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20
   #27 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) at framework/source/loadenv/loadenv.cxx:308:5
   #28 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&) at framework/source/loadenv/loadenv.cxx:168:14
   #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:591:16
   #30 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&) at framework/source/services/desktop.cxx
   #31 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:71:62
   #32 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at test/source/unoapi_test.cxx:126:19
   #33 in UnoApiTest::load(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:108:5
   #34 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) at sw/qa/unit/swmodeltestbase.cxx:441:20
   #35 in SwModelTestBase::loadAndReload(char const*) at sw/qa/unit/swmodeltestbase.cxx:466:5
   #36 in (anonymous namespace)::testMathEqarray::TestBody() at sw/qa/extras/rtfexport/rtfexport.cxx:198:5

Change-Id: I857861f5bc51a1e43bfbf5e0c9dbce542d673ca7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165664
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Apr 8, 2024
(tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 2024-04-01).
As reported by Stephan in https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82:

 `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now fails with

  vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the range of representable values of type 'long'
   #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at vcl/source/gdi/sallayout.cxx:245:30
   #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString const&, int, int, int, unsigned long, KernArraySpan, std::span<unsigned char const, 18446744073709551615ul>, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1932:28
   #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32
   #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString const&, unsigned short) at starmath/source/rect.cxx:224:21
   #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at starmath/source/node.cxx:2122:18
   #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:1340:17
   #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:816:13
   #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:610:20
   #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:534:20
   #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13
   #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9
   #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21
   #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at starmath/source/document.cxx:552:5
   #13 in SmDocShell::SetText(rtl::OUString const&) at starmath/source/document.cxx:188:9
   #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/document.cxx:848:5
   #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/unomodel.cxx:1105:22
   #16 in writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30
   #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23
   #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at writerfilter/source/rtftok/rtftokenizer.cxx:114:37
   #19 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27
   #20 in (anonymous namespace)::RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at writerfilter/source/filter/RtfFilter.cxx:163:20
   #21 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2392:34
   #22 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:760:23
   #23 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36
   #24 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&) at sfx2/source/view/frmload.cxx:720:28
   #25 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37
   #26 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20
   #27 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) at framework/source/loadenv/loadenv.cxx:308:5
   #28 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&) at framework/source/loadenv/loadenv.cxx:168:14
   #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:591:16
   #30 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&) at framework/source/services/desktop.cxx
   #31 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:71:62
   #32 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at test/source/unoapi_test.cxx:126:19
   #33 in UnoApiTest::load(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:108:5
   #34 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) at sw/qa/unit/swmodeltestbase.cxx:441:20
   #35 in SwModelTestBase::loadAndReload(char const*) at sw/qa/unit/swmodeltestbase.cxx:466:5
   #36 in (anonymous namespace)::testMathEqarray::TestBody() at sw/qa/extras/rtfexport/rtfexport.cxx:198:5

Change-Id: I857861f5bc51a1e43bfbf5e0c9dbce542d673ca7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165664
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Apr 9, 2024
(tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 2024-04-01).
As reported by Stephan in https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82:

 `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now fails with

  vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the range of representable values of type 'long'
   #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at vcl/source/gdi/sallayout.cxx:245:30
   #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString const&, int, int, int, unsigned long, KernArraySpan, std::span<unsigned char const, 18446744073709551615ul>, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1932:28
   #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32
   #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString const&, unsigned short) at starmath/source/rect.cxx:224:21
   #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at starmath/source/node.cxx:2122:18
   #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:1340:17
   #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:816:13
   #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:610:20
   #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:534:20
   #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13
   #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9
   #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21
   #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at starmath/source/document.cxx:552:5
   #13 in SmDocShell::SetText(rtl::OUString const&) at starmath/source/document.cxx:188:9
   #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/document.cxx:848:5
   #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/unomodel.cxx:1105:22
   #16 in writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30
   #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23
   #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at writerfilter/source/rtftok/rtftokenizer.cxx:114:37
   #19 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27
   #20 in (anonymous namespace)::RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at writerfilter/source/filter/RtfFilter.cxx:163:20
   #21 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2392:34
   #22 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:760:23
   #23 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36
   #24 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&) at sfx2/source/view/frmload.cxx:720:28
   #25 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37
   #26 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20
   #27 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) at framework/source/loadenv/loadenv.cxx:308:5
   #28 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&) at framework/source/loadenv/loadenv.cxx:168:14
   #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:591:16
   #30 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&) at framework/source/services/desktop.cxx
   #31 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:71:62
   #32 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at test/source/unoapi_test.cxx:126:19
   #33 in UnoApiTest::load(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:108:5
   #34 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) at sw/qa/unit/swmodeltestbase.cxx:441:20
   #35 in SwModelTestBase::loadAndReload(char const*) at sw/qa/unit/swmodeltestbase.cxx:466:5
   #36 in (anonymous namespace)::testMathEqarray::TestBody() at sw/qa/extras/rtfexport/rtfexport.cxx:198:5

Change-Id: I857861f5bc51a1e43bfbf5e0c9dbce542d673ca7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165664
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 51244eb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165844
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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 <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Apr 15, 2024
(tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 2024-04-01).
As reported by Stephan in https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82:

 `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now fails with

  vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the range of representable values of type 'long'
   #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at vcl/source/gdi/sallayout.cxx:245:30
   #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString const&, int, int, int, unsigned long, KernArraySpan, std::span<unsigned char const, 18446744073709551615ul>, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1932:28
   #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32
   #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString const&, unsigned short) at starmath/source/rect.cxx:224:21
   #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at starmath/source/node.cxx:2122:18
   #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:1340:17
   #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:816:13
   #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:610:20
   #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:534:20
   #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13
   #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9
   #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21
   #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at starmath/source/document.cxx:552:5
   #13 in SmDocShell::SetText(rtl::OUString const&) at starmath/source/document.cxx:188:9
   #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/document.cxx:848:5
   #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/unomodel.cxx:1105:22
   #16 in writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30
   #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23
   #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at writerfilter/source/rtftok/rtftokenizer.cxx:114:37
   #19 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27
   #20 in (anonymous namespace)::RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at writerfilter/source/filter/RtfFilter.cxx:163:20
   #21 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2392:34
   #22 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:760:23
   #23 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36
   #24 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&) at sfx2/source/view/frmload.cxx:720:28
   #25 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37
   #26 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20
   #27 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) at framework/source/loadenv/loadenv.cxx:308:5
   #28 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&) at framework/source/loadenv/loadenv.cxx:168:14
   #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:591:16
   #30 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&) at framework/source/services/desktop.cxx
   #31 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:71:62
   #32 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at test/source/unoapi_test.cxx:126:19
   #33 in UnoApiTest::load(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:108:5
   #34 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) at sw/qa/unit/swmodeltestbase.cxx:441:20
   #35 in SwModelTestBase::loadAndReload(char const*) at sw/qa/unit/swmodeltestbase.cxx:466:5
   #36 in (anonymous namespace)::testMathEqarray::TestBody() at sw/qa/extras/rtfexport/rtfexport.cxx:198:5

Change-Id: I857861f5bc51a1e43bfbf5e0c9dbce542d673ca7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165664
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 51244eb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165844
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request May 18, 2024
Fixes this crash/assertion seen when starting Writer with
the qt6 VCL plugin with a fresh user profile with qtbase debug
build (as of commit 70a2e7f32b9f9ce19d1538f14fbde7b0d1e77ffd):

    Thread 19 "soffice.bin" received signal SIGABRT, Aborted.
    [Switching to Thread 0x7fffada006c0 (LWP 150142)]
    __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  0x00007ffff78a6b7f 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  0x00007fffe34f95c9 in qAbort() () at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:49
    #5  0x00007fffe350d459 in qt_message_fatal<QString&>(QtMsgType, QMessageLogContext const&, QString&) (context=..., message=...) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:2112
    #6  0x00007fffe35063e6 in qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *)
        (msgType=QtFatalMsg, context=..., msg=0x7fffe3b8afa8 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0x7fffad9faab8) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:380
    #7  0x00007fffe35084b1 in QMessageLogger::fatal(char const*, ...) const (this=0x7fffad9fad00, msg=0x7fffe3b8afa8 "ASSERT failure in %s: \"%s\", file %s, line %d")
        at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:880
    #8  0x00007fffe34f969c in qt_assert_x(char const*, char const*, char const*, int)
        (where=0x7fffe3bae469 "QCoreApplication::sendEvent", what=0x7fff9d691f60 "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff9c456670. Receiver 'QtMainWindowClassWindow' (of type 'QWidgetWindow') was created in thread 0x0x55555560dc60", file=0x7fffe3bae098 "/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp", line=547) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:114
    #9  0x00007fffe35f54e6 in QCoreApplicationPrivate::checkReceiverThread(QObject*) (receiver=0x55555bb8a180) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:547
    #10 0x00007fffe15a786e in QApplication::notify(QObject*, QEvent*) (this=0x55555560d9e0, receiver=0x55555bb8a180, e=0x7fffad9fb120) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2580
    #11 0x00007fffe35f68be in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55555bb8a180, event=0x7fffad9fb120) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1154
    #12 0x00007fffe35f7677 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55555bb8a180, event=0x7fffad9fb120) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1598
    #13 0x00007fffe24f74d0 in QWindow::setIcon(QIcon const&) (this=0x55555bb8a180, icon=...) at /home/michi/development/git/qt5/qtbase/src/gui/kernel/qwindow.cpp:1094
    #14 0x00007fffe165564d in QWidgetPrivate::setWindowIcon_sys() (this=0x55555b24b370) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:6208
    #15 0x00007fffe1655598 in QWidget::setWindowIcon(QIcon const&) (this=0x55555735d7a0, icon=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:6198
    #16 0x00007fffe42362a9 in QtFrame::SetIcon(unsigned short) (this=0x55555bba7d30, nIcon=4) at vcl/qt6/../qt5/QtFrame.cxx:378
    #17 0x00007fffee0a2aa6 in SystemWindow::SetIcon(unsigned short) (this=0x7fff9d68a7c0, nIcon=4) at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:332
    #18 0x00007ffff4c843f1 in framework::TitleBarUpdate::impl_updateIcon(com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&)
        (this=0x7fff9c452fe0, xFrame=uno::Reference to ((anonymous namespace)::XFrameImpl *) 0x7fff9d68c690) at /home/michi/development/git/libreoffice/framework/source/helper/titlebarupdate.cxx:278
    #19 0x00007ffff4c831c2 in framework::TitleBarUpdate::impl_forceUpdate() (this=0x7fff9c452fe0) at /home/michi/development/git/libreoffice/framework/source/helper/titlebarupdate.cxx:214
    #20 0x00007ffff4c8304b in framework::TitleBarUpdate::frameAction(com::sun::star::frame::FrameActionEvent const&) (this=0x7fff9c452fe0, aEvent=...) at /home/michi/development/git/libreoffice/framework/source/helper/titlebarupdate.cxx:95
    #21 0x00007ffff4e25397 in (anonymous namespace)::XFrameImpl::implts_sendFrameActionEvent(com::sun::star::frame::FrameAction const&)
        (this=0x7fff9d68c620, aAction=@0x7ffff4a01f68: com::sun::star::frame::FrameAction::FrameAction_COMPONENT_ATTACHED) at /home/michi/development/git/libreoffice/framework/source/services/frame.cxx:2960
    #22 0x00007ffff4e1df33 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=0x7fff9d68c620, xComponentWindow=uno::Reference to (VCLXContainer *) 0x7fff9dd02cd0, xController=uno::Reference to (ScTabViewObj *) 0x7fff9d8d82d8)
        at /home/michi/development/git/libreoffice/framework/source/services/frame.cxx:1552
    #23 0x00007ffff40291b3 in utl::ConnectFrameControllerModel(com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController2> const&, com::sun::star::uno::Reference<com::sun::star::frame::XModel> const&)
        (xFrame=uno::Reference to ((anonymous namespace)::XFrameImpl *) 0x7fff9d68c690, xController=uno::Reference to (ScTabViewObj *) 0x7fff9d8d82d8, xModel=uno::Reference to (ScModelObj *) 0x7fff9c471680) at include/unotools/fcm.hxx:45
    #24 0x00007ffff402551a in (anonymous namespace)::SfxFrameLoader_Impl::impl_createDocumentView(com::sun::star::uno::Reference<com::sun::star::frame::XModel2> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, comphelper::NamedValueCollection const&, rtl::OUString const&)
        (i_rModel=uno::Reference to (ScModelObj *) 0x7fff9c471680, i_rFrame=uno::Reference to ((anonymous namespace)::XFrameImpl *) 0x7fff9d68c690, i_rViewFactoryArgs=..., i_rViewName="Default")
        at /home/michi/development/git/libreoffice/sfx2/source/view/frmload.cxx:584
    #25 0x00007ffff402272f 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&)
        (this=0x7fff9c451600, rArgs=uno::Sequence of length 11 = {...}, _rTargetFrame=uno::Reference to ((anonymous namespace)::XFrameImpl *) 0x7fff9d68c690) at /home/michi/development/git/libreoffice/sfx2/source/view/frmload.cxx:759
    #26 0x00007ffff4dd7b61 in framework::LoadEnv::impl_loadContent() (this=0x7fffad9fcbb8) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:1176
    #27 0x00007ffff4dd48e4 in framework::LoadEnv::start() (this=0x7fffad9fcbb8) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:412
    #28 0x00007ffff4dd21b2 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=0x7fffad9fcbb8, sURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods", lMediaDescriptor=uno::Sequence of length 1 = {...}, xBaseFrame=uno::Reference to (framework::Desktop *) 0x5555569ad308, sTarget="_blank", nSearchFlags=0, eFeature=LoadEnvFeatures::NONE) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:308
    #29 0x00007ffff4dd0998 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&)
        (xLoader=uno::Reference to (framework::Desktop *) 0x5555569ad318, xContext=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x555555623d48, sURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods", sTarget="_blank", nSearchFlags=0, lArgs=uno::Sequence of length 1 = {...}) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:168
    #30 0x00007ffff4e06a3f in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
        (this=0x5555569ad2a0, sURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods", sTargetFrameName="_blank", nSearchFlags=0, lArguments=uno::Sequence of length 1 = {...})
        at /home/michi/development/git/libreoffice/framework/source/services/desktop.cxx:592
    #31 0x00007ffff4e06b34 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&) ()
        at /home/michi/development/git/libreoffice/instdir/program/libfwklo.so
    #32 0x00007ffff7ba9147 in desktop::testOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&, rtl::OUString const&)
        (xDesktop=uno::Reference to (framework::Desktop *) 0x5555569ad2f8, rURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods")
        at /home/michi/development/git/libreoffice/desktop/source/app/opencl.cxx:132
    #33 0x00007ffff7ba7f54 in desktop::Desktop::CheckOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&) (xDesktop=uno::Reference to (framework::Desktop *) 0x5555569ad2f8)
    --Type <RET> for more, q to quit, c to continue without paging--
        at /home/michi/development/git/libreoffice/desktop/source/app/opencl.cxx:241
    #34 0x00007ffff7b5719d in std::__invoke_impl<void, void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> >(std::__invoke_other, void (*&&)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>&&)
        (__f=@0x5555573c20b0: 0x7ffff7ba7760 <desktop::Desktop::CheckOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&)>, __args=...)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:61
    #35 0x00007ffff7b5712d in std::__invoke<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> >(void (*&&)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>&&)
        (__fn=@0x5555573c20b0: 0x7ffff7ba7760 <desktop::Desktop::CheckOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&)>, __args=...)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:96
    #36 0x00007ffff7b57102 in std::thread::_Invoker<std::tuple<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> > >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0x5555573c20a8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_thread.h:292
    #37 0x00007ffff7b570c5 in std::thread::_Invoker<std::tuple<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> > >::operator()()
        (this=0x5555573c20a8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_thread.h:299
    #38 0x00007ffff7b56e69 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> > > >::_M_run() (this=0x5555573c20a0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_thread.h:244
    #39 0x00007ffff74dee24 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
    #40 0x00007ffff78a4dbb in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
    #41 0x00007ffff79269f8 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Change-Id: Ic611eb26b140c060cba4d81603e506806cf43bab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167778
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
tdf-gerrit pushed a commit that referenced this pull request May 18, 2024
Fixes this crash/assertion seen when starting Writer with
the qt6 VCL plugin with a fresh user profile with qtbase debug
build (as of commit 70a2e7f32b9f9ce19d1538f14fbde7b0d1e77ffd):

    ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff9c454020. Receiver 'QtMainWindowClassWindow' (of type 'QWidgetWindow') was created in thread 0x0x55555560dc50", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 547

    Thread 19 "soffice.bin" received signal SIGABRT, Aborted.
    [Switching to Thread 0x7fffada006c0 (LWP 10947)]
    __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  0x00007ffff78a6b7f 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  0x00007fffe34f95c9 in qAbort() () at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:49
    #5  0x00007fffe350d459 in qt_message_fatal<QString&>(QtMsgType, QMessageLogContext const&, QString&) (context=..., message=...) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:2112
    #6  0x00007fffe35063e6 in qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *)
        (msgType=QtFatalMsg, context=..., msg=0x7fffe3b8afa8 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0x7fffad9fb108) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:380
    #7  0x00007fffe35084b1 in QMessageLogger::fatal(char const*, ...) const (this=0x7fffad9fb350, msg=0x7fffe3b8afa8 "ASSERT failure in %s: \"%s\", file %s, line %d")
        at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:880
    #8  0x00007fffe34f969c in qt_assert_x(char const*, char const*, char const*, int)
        (where=0x7fffe3bae469 "QCoreApplication::sendEvent", what=0x7fff9cd289a0 "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff9c454020. Receiver 'QtMainWindowClassWindow' (of type 'QWidgetWindow') was created in thread 0x0x55555560dc50", file=0x7fffe3bae098 "/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp", line=547) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:114
    #9  0x00007fffe35f54e6 in QCoreApplicationPrivate::checkReceiverThread(QObject*) (receiver=0x55555bb8b4a0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:547
    #10 0x00007fffe15a786e in QApplication::notify(QObject*, QEvent*) (this=0x55555560d9d0, receiver=0x55555bb8b4a0, e=0x7fffad9fb7f0) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2580
    #11 0x00007fffe35f68be in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55555bb8b4a0, event=0x7fffad9fb7f0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1154
    #12 0x00007fffe35f7677 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x55555bb8b4a0, event=0x7fffad9fb7f0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1598
    #13 0x00007fffe24f6299 in QWindowPrivate::create(bool) (this=0x5555569bd9a0, recursive=false) at /home/michi/development/git/qt5/qtbase/src/gui/kernel/qwindow.cpp:589
    #14 0x00007fffe24f6759 in QWindow::create() (this=0x55555bb8b4a0) at /home/michi/development/git/qt5/qtbase/src/gui/kernel/qwindow.cpp:720
    #15 0x00007fffe1643f45 in QWidgetPrivate::create() (this=0x55555b24c140) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:1341
    #16 0x00007fffe16433c3 in QWidget::create(unsigned long long, bool, bool) (this=0x5555572554a0, window=0, initializeWindow=true, destroyOldWindow=true) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:1206
    #17 0x00007fffe1649dd5 in QWidget::setWindowState(QFlags<Qt::WindowState>) (this=0x5555572554a0, newstate=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:2946
    #18 0x00007fffe4235db6 in QtFrame::SetWindowStateImpl(QFlags<Qt::WindowState>) (this=0x55555bba8cf0, eState=...) at vcl/qt6/../qt5/QtFrame.cxx:340
    #19 0x00007fffe4237fc0 in QtFrame::SetWindowState(vcl::WindowData const*) (this=0x55555bba8cf0, pState=0x7fffad9fbdc0) at vcl/qt6/../qt5/QtFrame.cxx:677
    #20 0x00007fffee0a4c63 in SystemWindow::SetWindowState(vcl::WindowData const&) (this=0x7fff9d689d50, rData=...) at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:708
    #21 0x00007fffee0a5802 in SystemWindow::SetWindowState(std::basic_string_view<char16_t, std::char_traits<char16_t> >) (this=0x7fff9d689d50, rStr=u",,,;4;") at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:840
    #22 0x00007ffff4ddc4c4 in framework::LoadEnv::impl_applyPersistentWindowState(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&) (this=0x7fffad9fcbb8, xWindow=uno::Reference to (VCLXTopWindow *) 0x7fff9c003810)
        at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:1809
    #23 0x00007ffff4dd6f5b in framework::LoadEnv::impl_loadContent() (this=0x7fffad9fcbb8) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:1081
    #24 0x00007ffff4dd48e4 in framework::LoadEnv::start() (this=0x7fffad9fcbb8) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:412
    #25 0x00007ffff4dd21b2 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=0x7fffad9fcbb8, sURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods", lMediaDescriptor=uno::Sequence of length 1 = {...}, xBaseFrame=uno::Reference to (framework::Desktop *) 0x5555569d5c68, sTarget="_blank", nSearchFlags=0, eFeature=LoadEnvFeatures::NONE) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:308
    #26 0x00007ffff4dd0998 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&)
        (xLoader=uno::Reference to (framework::Desktop *) 0x5555569d5c78, xContext=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x555555623d38, sURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods", sTarget="_blank", nSearchFlags=0, lArgs=uno::Sequence of length 1 = {...}) at /home/michi/development/git/libreoffice/framework/source/loadenv/loadenv.cxx:168
    #27 0x00007ffff4e06a3f in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
        (this=0x5555569d5c00, sURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods", sTargetFrameName="_blank", nSearchFlags=0, lArguments=uno::Sequence of length 1 = {...})
        at /home/michi/development/git/libreoffice/framework/source/services/desktop.cxx:592
    #28 0x00007ffff4e06b34 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&) ()
        at /home/michi/development/git/libreoffice/instdir/program/libfwklo.so
    #29 0x00007ffff7ba9147 in desktop::testOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&, rtl::OUString const&)
        (xDesktop=uno::Reference to (framework::Desktop *) 0x5555569d5c58, rURL="file:///home/michi/development/git/libreoffice/instdir/program/../program/opencl/cl-test.ods")
        at /home/michi/development/git/libreoffice/desktop/source/app/opencl.cxx:132
    #30 0x00007ffff7ba7f54 in desktop::Desktop::CheckOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&) (xDesktop=uno::Reference to (framework::Desktop *) 0x5555569d5c58)
        at /home/michi/development/git/libreoffice/desktop/source/app/opencl.cxx:241
    #31 0x00007ffff7b5719d in std::__invoke_impl<void, void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> >(std::__invoke_other, void (*&&)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>&&)
        (__f=@0x555556fbe460: 0x7ffff7ba7760 <desktop::Desktop::CheckOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&)>, __args=...)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:61
    #32 0x00007ffff7b5712d in std::__invoke<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> >(void (*&&)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2>&&)
        (__fn=@0x555556fbe460: 0x7ffff7ba7760 <desktop::Desktop::CheckOpenCLCompute(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&)>, __args=...)
        at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:96
    #33 0x00007ffff7b57102 in std::thread::_Invoker<std::tuple<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> > >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (this=0x555556fbe458) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_thread.h:292
    #34 0x00007ffff7b570c5 in std::thread::_Invoker<std::tuple<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> > >::operator()()
        (this=0x555556fbe458) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_thread.h:299
    #35 0x00007ffff7b56e69 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> const&), com::sun::star::uno::Reference<com::sun::star::frame::XDesktop2> > > >::_M_run() (this=0x555556fbe450) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_thread.h:244
    #36 0x00007ffff74dee24 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
    #37 0x00007ffff78a4dbb in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
    #38 0x00007ffff79269f8 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Change-Id: I35024670cf4e4a6c00762be71fa051cc9417ef75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167779
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
tdf-gerrit pushed a commit that referenced this pull request Jun 1, 2024
(tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 2024-04-01).
As reported by Stephan in https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82:

 `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now fails with

  vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the range of representable values of type 'long'
   #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at vcl/source/gdi/sallayout.cxx:245:30
   #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString const&, int, int, int, unsigned long, KernArraySpan, std::span<unsigned char const, 18446744073709551615ul>, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1932:28
   #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32
   #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString const&, unsigned short) at starmath/source/rect.cxx:224:21
   #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at starmath/source/node.cxx:2122:18
   #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:1340:17
   #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:816:13
   #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:610:20
   #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:534:20
   #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13
   #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9
   #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21
   #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at starmath/source/document.cxx:552:5
   #13 in SmDocShell::SetText(rtl::OUString const&) at starmath/source/document.cxx:188:9
   #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/document.cxx:848:5
   #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/unomodel.cxx:1105:22
   #16 in writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30
   #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23
   #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at writerfilter/source/rtftok/rtftokenizer.cxx:114:37
   #19 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27
   #20 in (anonymous namespace)::RtfFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at writerfilter/source/filter/RtfFilter.cxx:163:20
   #21 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference<com::sun::star::text::XTextRange> const&) at sfx2/source/doc/objstor.cxx:2392:34
   #22 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:760:23
   #23 in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36
   #24 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&) at sfx2/source/view/frmload.cxx:720:28
   #25 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37
   #26 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20
   #27 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) at framework/source/loadenv/loadenv.cxx:308:5
   #28 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&) at framework/source/loadenv/loadenv.cxx:168:14
   #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:591:16
   #30 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&) at framework/source/services/desktop.cxx
   #31 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:71:62
   #32 in UnoApiTest::loadWithParams(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at test/source/unoapi_test.cxx:126:19
   #33 in UnoApiTest::load(rtl::OUString const&, char const*) at test/source/unoapi_test.cxx:108:5
   #34 in SwModelTestBase::loadURL(rtl::OUString const&, char const*) at sw/qa/unit/swmodeltestbase.cxx:441:20
   #35 in SwModelTestBase::loadAndReload(char const*) at sw/qa/unit/swmodeltestbase.cxx:466:5
   #36 in (anonymous namespace)::testMathEqarray::TestBody() at sw/qa/extras/rtfexport/rtfexport.cxx:198:5

Change-Id: I857861f5bc51a1e43bfbf5e0c9dbce542d673ca7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165664
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
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 <m.weghorn@posteo.de>
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 <m.weghorn@posteo.de>
(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 <stephan.bergmann@allotropia.de>
(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 <m.weghorn@posteo.de>
Tested-by: Jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants