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

Commenting on osl_waitThread #1

Closed
wants to merge 1 commit into from
Closed

Commenting on osl_waitThread #1

wants to merge 1 commit into from

Conversation

andre-yai
Copy link

Andre Yai - comment using sleep and usleep.

Andre Yai - comment using sleep and usleep.
@erAck
Copy link
Contributor

erAck commented Nov 7, 2014

Please, we don't merge github pull requests, which would be unmanageable with a project of this size. In fact the LibreOffice github repository is a clone of our gerrit repository and updated from there. For how to submit patches please see https://wiki.documentfoundation.org/Development/gerrit
Thank you and welcome! :-)

ghost pushed a commit that referenced this pull request Nov 11, 2014
This is similar to fdo#72695, just with SfxBroadcaster in Calc.
Solve it in a similar way, by putting a WeakReference to "this" into the
UNO object so its Notify() can return if another thread is already in
the dtor waiting for the SolarMutex.

==11581==ERROR: AddressSanitizer: heap-use-after-free on address 0x6170006fdb08 at pc 0x2b2c4f5b8e3e bp 0x2b2c0b2ad9f0 sp 0x2b2c0b2ad9e8
READ of size 8 at 0x6170006fdb08 thread T262 (cppu_threadpool)
    #0 0x2b2c4f5b8e3d in ScCellRangesBase::~ScCellRangesBase() /sc/source/ui/unoobj/cellsuno.cxx:1448
    #1 0x2b2c4f643914 in ScCellRangeObj::~ScCellRangeObj() /sc/source/ui/unoobj/cellsuno.cxx:4751
    #2 0x2b2c4f697624 in ScCellObj::~ScCellObj() /sc/source/ui/unoobj/cellsuno.cxx:6053
    #3 0x2b2c4f69648d in ScCellObj::~ScCellObj() /sc/source/ui/unoobj/cellsuno.cxx:6052
    #4 0x2b2c4f69661f in non-virtual thunk to ScCellObj::~ScCellObj() /sc/source/ui/unoobj/cellsuno.cxx:6053
    #5 0x2b2b2c58b6af in cppu::OWeakObject::release() /cppuhelper/source/weak.cxx:204
    #6 0x2b2c4f5c50ff in ScCellRangesBase::release() /sc/source/ui/unoobj/cellsuno.cxx:1752
    #7 0x2b2c4f64de58 in ScCellRangeObj::release() /sc/source/ui/unoobj/cellsuno.cxx:4800
    #8 0x2b2c4f6a2c08 in ScCellObj::release() /sc/source/ui/unoobj/cellsuno.cxx:6093
    #9 0x2b2c4f6a5f0f in non-virtual thunk to ScCellObj::release() /sc/source/ui/unoobj/cellsuno.cxx:6094
    #10 0x2b2c053b96fb in bridges::cpp_uno::shared::freeUnoInterfaceProxy(_uno_ExtEnvironment*, void*) /bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:43
    #11 0x2b2b2bae80fb in (anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1]) /cppu/source/uno/lbenv.cxx:383

0x6170006fdb08 is located 264 bytes inside of 728-byte region [0x6170006fda00,0x6170006fdcd8)
freed by thread T264 (cppu_threadpool) here:
    #3 0x2b2c49c980f5 in cppu::OWeakObject::operator delete(void*) /include/cppuhelper/weak.hxx:87
    #4 0x2b2c4f5b840a in ScCellRangesBase::~ScCellRangesBase() /sc/source/ui/unoobj/cellsuno.cxx:1442
    #5 0x2b2c4f5b858f in non-virtual thunk to ScCellRangesBase::~ScCellRangesBase() /sc/source/ui/unoobj/cellsuno.cxx:1458
    #6 0x2b2b2c58b6af in cppu::OWeakObject::release() /cppuhelper/source/weak.cxx:204
    #7 0x2b2c4f5c50ff in ScCellRangesBase::release() /sc/source/ui/unoobj/cellsuno.cxx:1752
    #8 0x2b2c4f5c65ff in non-virtual thunk to ScCellRangesBase::release() /sc/source/ui/unoobj/cellsuno.cxx:1753
    #9 0x2b2c4af84583 in com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::~Reference() /include/com/sun/star/uno/Reference.hxx:104
    #10 0x2b2c4f5bc66f in ScCellRangesBase::Notify(SfxBroadcaster&, SfxHint const&) /sc/source/ui/unoobj/cellsuno.cxx:1570
    #11 0x2b2c4f5bdf0d in non-virtual thunk to ScCellRangesBase::Notify(SfxBroadcaster&, SfxHint const&) /sc/source/ui/unoobj/cellsuno.cxx:1645
    #12 0x2b2b31dda705 in SfxBroadcaster::Broadcast(SfxHint const&) /svl/source/notify/SfxBroadcaster.cxx:41
    #13 0x2b2c4b03f2e4 in ScDocument::InsertTab(short, rtl::OUString const&, bool, bool) /sc/source/core/data/document.cxx:510
    #14 0x2b2c4e7ed861 in ScDocFunc::InsertTable(short, rtl::OUString const&, bool, bool) /sc/source/ui/docshell/docfunc.cxx:3007
    #15 0x2b2c50b1f415 in ScViewFunc::InsertTable(rtl::OUString const&, short, bool) /sc/source/ui/view/viewfun2.cxx:1855
    #16 0x2b2c502e075f in ScDBFunc::ShowDataPilotSourceData(ScDPObject&, com::sun::star::uno::Sequence<com::sun::star::sheet::DataPilotFieldFilter> const&) /sc/source/ui/view/dbfunc3.cxx:2056
    #17 0x2b2c4fa8924d in ScDataPilotTableObj::insertDrillDownSheet(com::sun::star::table::CellAddress const&) /sc/source/ui/unoobj/dapiuno.cxx:1286

Change-Id: I4cd0fca46b9b81311bddfab2229ab9abf4c06c4e
ghost pushed a commit that referenced this pull request Jan 10, 2015
Probably 03cca06 was not sufficient,
because the ~ScCellRangesBase may access a deleted ScDocument after the
early return.

READ of size 8 at 0x61b000191cb0 thread T7 (cppu_threadpool)
    #0 0x2b3c8fd7c8b3 in ScDocument::RemoveUnoObject(SfxListener&) sc/source/core/data/documen3.cxx:863:9
    #1 0x2b3c94517824 in ScCellRangesBase::~ScCellRangesBase() sc/source/ui/unoobj/cellsuno.cxx:1467:9
    #2 0x2b3c9459cf98 in ScCellRangeObj::~ScCellRangeObj() sc/source/ui/unoobj/cellsuno.cxx:4786:1
    #3 0x2b3c945eca28 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #4 0x2b3c945ecef1 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6087:1
    #5 0x2b3c945ed093 in non-virtual thunk to ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #6 0x2b3c56cb35ec in cppu::OWeakObject::release() cppuhelper/source/weak.cxx:205:9
    #7 0x2b3c94523d63 in ScCellRangesBase::release() sc/source/ui/unoobj/cellsuno.cxx:1772:5
    #8 0x2b3c945a77ec in ScCellRangeObj::release() sc/source/ui/unoobj/cellsuno.cxx:4835:5
    #9 0x2b3c945f842c in ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6128:5
    #10 0x2b3c945fb953 in non-virtual thunk to ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6129:1
    #11 0x2b3c7f305faa in bridges::cpp_uno::shared::freeUnoInterfaceProxy(_uno_ExtEnvironment*, void*) bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42:5

freed by thread T14 (cppu_threadpool) here:
    #0 0x43436b in operator delete(void*) (/data/lo/build_clang/instdir/program/soffice.bin+0x43436b)
    #1 0x2b3c9382462e in ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2722:1
    #2 0x2b3c93824d46 in virtual thunk to ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2755:1
    #3 0x2b3c58e2058a in SvRefBase::ReleaseRef() include/tools/ref.hxx:194:29
    #4 0x2b3c58e12726 in tools::SvRef<SfxObjectShell>::~SvRef() include/tools/ref.hxx:52:24
    #5 0x2b3c5a8a8f99 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:247:5
    #6 0x2b3c5a8a9141 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:246:5
    #7 0x2b3c5a7b1905 in SfxBaseModel::dispose() sfx2/source/doc/sfxbasemodel.cxx:795:5
    #8 0x2b3c5a7c8146 in SfxBaseModel::close(unsigned char) sfx2/source/doc/sfxbasemodel.cxx:1418:5

Change-Id: Ia041dc6596d1b0b6b979a20fa93e1490c657e15b
ghost pushed a commit that referenced this pull request Jan 12, 2015
Probably 03cca06 was not sufficient,
because the ~ScCellRangesBase may access a deleted ScDocument after the
early return.

READ of size 8 at 0x61b000191cb0 thread T7 (cppu_threadpool)
    #0 0x2b3c8fd7c8b3 in ScDocument::RemoveUnoObject(SfxListener&) sc/source/core/data/documen3.cxx:863:9
    #1 0x2b3c94517824 in ScCellRangesBase::~ScCellRangesBase() sc/source/ui/unoobj/cellsuno.cxx:1467:9
    #2 0x2b3c9459cf98 in ScCellRangeObj::~ScCellRangeObj() sc/source/ui/unoobj/cellsuno.cxx:4786:1
    #3 0x2b3c945eca28 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #4 0x2b3c945ecef1 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6087:1
    #5 0x2b3c945ed093 in non-virtual thunk to ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #6 0x2b3c56cb35ec in cppu::OWeakObject::release() cppuhelper/source/weak.cxx:205:9
    #7 0x2b3c94523d63 in ScCellRangesBase::release() sc/source/ui/unoobj/cellsuno.cxx:1772:5
    #8 0x2b3c945a77ec in ScCellRangeObj::release() sc/source/ui/unoobj/cellsuno.cxx:4835:5
    #9 0x2b3c945f842c in ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6128:5
    #10 0x2b3c945fb953 in non-virtual thunk to ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6129:1
    #11 0x2b3c7f305faa in bridges::cpp_uno::shared::freeUnoInterfaceProxy(_uno_ExtEnvironment*, void*) bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42:5

freed by thread T14 (cppu_threadpool) here:
    #0 0x43436b in operator delete(void*) (/data/lo/build_clang/instdir/program/soffice.bin+0x43436b)
    #1 0x2b3c9382462e in ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2722:1
    #2 0x2b3c93824d46 in virtual thunk to ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2755:1
    #3 0x2b3c58e2058a in SvRefBase::ReleaseRef() include/tools/ref.hxx:194:29
    #4 0x2b3c58e12726 in tools::SvRef<SfxObjectShell>::~SvRef() include/tools/ref.hxx:52:24
    #5 0x2b3c5a8a8f99 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:247:5
    #6 0x2b3c5a8a9141 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:246:5
    #7 0x2b3c5a7b1905 in SfxBaseModel::dispose() sfx2/source/doc/sfxbasemodel.cxx:795:5
    #8 0x2b3c5a7c8146 in SfxBaseModel::close(unsigned char) sfx2/source/doc/sfxbasemodel.cxx:1418:5

Change-Id: Ia041dc6596d1b0b6b979a20fa93e1490c657e15b
ghost pushed a commit that referenced this pull request Jan 14, 2015
Probably 03cca06 was not sufficient,
because the ~ScCellRangesBase may access a deleted ScDocument after the
early return.

READ of size 8 at 0x61b000191cb0 thread T7 (cppu_threadpool)
    #0 0x2b3c8fd7c8b3 in ScDocument::RemoveUnoObject(SfxListener&) sc/source/core/data/documen3.cxx:863:9
    #1 0x2b3c94517824 in ScCellRangesBase::~ScCellRangesBase() sc/source/ui/unoobj/cellsuno.cxx:1467:9
    #2 0x2b3c9459cf98 in ScCellRangeObj::~ScCellRangeObj() sc/source/ui/unoobj/cellsuno.cxx:4786:1
    #3 0x2b3c945eca28 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #4 0x2b3c945ecef1 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6087:1
    #5 0x2b3c945ed093 in non-virtual thunk to ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #6 0x2b3c56cb35ec in cppu::OWeakObject::release() cppuhelper/source/weak.cxx:205:9
    #7 0x2b3c94523d63 in ScCellRangesBase::release() sc/source/ui/unoobj/cellsuno.cxx:1772:5
    #8 0x2b3c945a77ec in ScCellRangeObj::release() sc/source/ui/unoobj/cellsuno.cxx:4835:5
    #9 0x2b3c945f842c in ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6128:5
    #10 0x2b3c945fb953 in non-virtual thunk to ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6129:1
    #11 0x2b3c7f305faa in bridges::cpp_uno::shared::freeUnoInterfaceProxy(_uno_ExtEnvironment*, void*) bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42:5

freed by thread T14 (cppu_threadpool) here:
    #0 0x43436b in operator delete(void*) (/data/lo/build_clang/instdir/program/soffice.bin+0x43436b)
    #1 0x2b3c9382462e in ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2722:1
    #2 0x2b3c93824d46 in virtual thunk to ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2755:1
    #3 0x2b3c58e2058a in SvRefBase::ReleaseRef() include/tools/ref.hxx:194:29
    #4 0x2b3c58e12726 in tools::SvRef<SfxObjectShell>::~SvRef() include/tools/ref.hxx:52:24
    #5 0x2b3c5a8a8f99 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:247:5
    #6 0x2b3c5a8a9141 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:246:5
    #7 0x2b3c5a7b1905 in SfxBaseModel::dispose() sfx2/source/doc/sfxbasemodel.cxx:795:5
    #8 0x2b3c5a7c8146 in SfxBaseModel::close(unsigned char) sfx2/source/doc/sfxbasemodel.cxx:1418:5

Change-Id: Ia041dc6596d1b0b6b979a20fa93e1490c657e15b
(cherry picked from commit c6dc3b9)
Reviewed-on: https://gerrit.libreoffice.org/13871
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
ghost pushed a commit that referenced this pull request Feb 9, 2015
Probably 03cca06 was not sufficient,
because the ~ScCellRangesBase may access a deleted ScDocument after the
early return.

READ of size 8 at 0x61b000191cb0 thread T7 (cppu_threadpool)
    #0 0x2b3c8fd7c8b3 in ScDocument::RemoveUnoObject(SfxListener&) sc/source/core/data/documen3.cxx:863:9
    #1 0x2b3c94517824 in ScCellRangesBase::~ScCellRangesBase() sc/source/ui/unoobj/cellsuno.cxx:1467:9
    #2 0x2b3c9459cf98 in ScCellRangeObj::~ScCellRangeObj() sc/source/ui/unoobj/cellsuno.cxx:4786:1
    #3 0x2b3c945eca28 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #4 0x2b3c945ecef1 in ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6087:1
    #5 0x2b3c945ed093 in non-virtual thunk to ScCellObj::~ScCellObj() sc/source/ui/unoobj/cellsuno.cxx:6088:1
    #6 0x2b3c56cb35ec in cppu::OWeakObject::release() cppuhelper/source/weak.cxx:205:9
    #7 0x2b3c94523d63 in ScCellRangesBase::release() sc/source/ui/unoobj/cellsuno.cxx:1772:5
    #8 0x2b3c945a77ec in ScCellRangeObj::release() sc/source/ui/unoobj/cellsuno.cxx:4835:5
    #9 0x2b3c945f842c in ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6128:5
    #10 0x2b3c945fb953 in non-virtual thunk to ScCellObj::release() sc/source/ui/unoobj/cellsuno.cxx:6129:1
    #11 0x2b3c7f305faa in bridges::cpp_uno::shared::freeUnoInterfaceProxy(_uno_ExtEnvironment*, void*) bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42:5

freed by thread T14 (cppu_threadpool) here:
    #0 0x43436b in operator delete(void*) (/data/lo/build_clang/instdir/program/soffice.bin+0x43436b)
    #1 0x2b3c9382462e in ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2722:1
    #2 0x2b3c93824d46 in virtual thunk to ScDocShell::~ScDocShell() sc/source/ui/docshell/docsh.cxx:2755:1
    #3 0x2b3c58e2058a in SvRefBase::ReleaseRef() include/tools/ref.hxx:194:29
    #4 0x2b3c58e12726 in tools::SvRef<SfxObjectShell>::~SvRef() include/tools/ref.hxx:52:24
    #5 0x2b3c5a8a8f99 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:247:5
    #6 0x2b3c5a8a9141 in IMPL_SfxBaseModel_DataContainer::~IMPL_SfxBaseModel_DataContainer() sfx2/source/doc/sfxbasemodel.cxx:246:5
    #7 0x2b3c5a7b1905 in SfxBaseModel::dispose() sfx2/source/doc/sfxbasemodel.cxx:795:5
    #8 0x2b3c5a7c8146 in SfxBaseModel::close(unsigned char) sfx2/source/doc/sfxbasemodel.cxx:1418:5

Change-Id: Ia041dc6596d1b0b6b979a20fa93e1490c657e15b
ghost pushed a commit that referenced this pull request Feb 13, 2015
* pib structure in rtf shape is processed always, if exists, not only
  for shape #75 (picture frame): it is possible for other shapes, at
  least for #1 (rectangle)

* picture inside shape gets width and height from shape: this picture
  looks like pib object and should fit shape frame

Conflicts:
	sw/qa/extras/rtfimport/rtfimport.cxx

Reviewed on:
	https://gerrit.libreoffice.org/14396

Change-Id: I5cf2e692940c4ddd8ab8b291ef65c0cc44c45f5d
ghost pushed a commit that referenced this pull request Apr 29, 2015
	0x00007ffff0b36bf0 in OutputDevice::disposeOnce (this=0x0) at /git/libreoffice/master/vcl/source/outdev/outdev.cxx:193
	193         if ( mbDisposed )
	(gdb) up
	#1  0x00007ffff3c3d651 in SfxInfoBarContainerWindow::removeInfoBar (this=0x1f05b30, pInfoBar=0x0) at /git/libreoffice/master/sfx2/source/dialog/infobar.cxx:294
	294         pInfoBar->disposeOnce();

Change-Id: I7b5dfddea98d8ab3d4f7db3ef53660f91e5ad80b
ghost pushed a commit that referenced this pull request Jun 2, 2015
Change-Id: I95c6669cfbdcbc81c5a173a6687fca14bed255fb
Reviewed-on: https://gerrit.libreoffice.org/16003
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
@ghost ghost closed this Jul 22, 2015
ghost pushed a commit that referenced this pull request Aug 14, 2015
At least with my AMD card, in case of SAL_FORCEGL=1 the startup crashes
quite early. DrMemory says:

~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS: writing 0x00001414-0x00001415 1 byte(s)
~~Dr.M~~ # 0 atioglxx.dll!DrvPresentBuffers                          +0xd6ea6  (0x09a248f6 <atioglxx.dll+0x1248f6>)
~~Dr.M~~ # 1 atioglxx.dll!DrvPresentBuffers                          +0x3c069c (0x09d0e0ed <atioglxx.dll+0x40e0ed>)
~~Dr.M~~ # 2 vcllo.dll!OpenGLContext::InitGLEW                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:949]
~~Dr.M~~ # 3 vcllo.dll!OpenGLContext::ImplInit                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:866]
~~Dr.M~~ # 4 vcllo.dll!OpenGLContext::init                            [c:\lo\master\vcl\source\opengl\openglcontext.cxx:786]
~~Dr.M~~ # 5 vcllo.dll!WinOpenGLSalGraphicsImpl::CreateWinContext     [c:\lo\master\vcl\opengl\win\gdiimpl.cxx:36]

Turns out that in order to enable the GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
extension, the GL context must be created with WGL_CONTEXT_DEBUG_BIT_ARB
set. It seems that other drivers did not enforce this so far, but in
this case the driver just crashes without this.

Fix the problem by splitting out the debug setup part of InitGLEW() into
a new InitGLEWDebugging(), and at least on Windows call it only after
wglCreateContextAttribsARB() and wglMakeCurrent(). Additionally make
sure that in the debug case the necessary flag is passed to
wglCreateContextAttribsARB().

Change-Id: I6b77e0c06fd85fdae0386a0801f1de1838524586
Reviewed-on: https://gerrit.libreoffice.org/17750
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
ghost pushed a commit that referenced this pull request Sep 1, 2015
At least with my AMD card, in case of SAL_FORCEGL=1 the startup crashes
quite early. DrMemory says:

~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS: writing 0x00001414-0x00001415 1 byte(s)
~~Dr.M~~ # 0 atioglxx.dll!DrvPresentBuffers                          +0xd6ea6  (0x09a248f6 <atioglxx.dll+0x1248f6>)
~~Dr.M~~ # 1 atioglxx.dll!DrvPresentBuffers                          +0x3c069c (0x09d0e0ed <atioglxx.dll+0x40e0ed>)
~~Dr.M~~ # 2 vcllo.dll!OpenGLContext::InitGLEW                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:949]
~~Dr.M~~ # 3 vcllo.dll!OpenGLContext::ImplInit                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:866]
~~Dr.M~~ # 4 vcllo.dll!OpenGLContext::init                            [c:\lo\master\vcl\source\opengl\openglcontext.cxx:786]
~~Dr.M~~ # 5 vcllo.dll!WinOpenGLSalGraphicsImpl::CreateWinContext     [c:\lo\master\vcl\opengl\win\gdiimpl.cxx:36]

Turns out that in order to enable the GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
extension, the GL context must be created with WGL_CONTEXT_DEBUG_BIT_ARB
set. It seems that other drivers did not enforce this so far, but in
this case the driver just crashes without this.

Fix the problem by splitting out the debug setup part of InitGLEW() into
a new InitGLEWDebugging(), and at least on Windows call it only after
wglCreateContextAttribsARB() and wglMakeCurrent(). Additionally make
sure that in the debug case the necessary flag is passed to
wglCreateContextAttribsARB().

Conflicts:
	vcl/source/opengl/OpenGLContext.cxx

Change-Id: I6b77e0c06fd85fdae0386a0801f1de1838524586
Reviewed-on: https://gerrit.libreoffice.org/17750
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/18219
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
ghost pushed a commit that referenced this pull request Sep 18, 2015
At least with my AMD card, in case of SAL_FORCEGL=1 the startup crashes
quite early. DrMemory says:

~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS: writing 0x00001414-0x00001415 1 byte(s)
~~Dr.M~~ # 0 atioglxx.dll!DrvPresentBuffers                          +0xd6ea6  (0x09a248f6 <atioglxx.dll+0x1248f6>)
~~Dr.M~~ # 1 atioglxx.dll!DrvPresentBuffers                          +0x3c069c (0x09d0e0ed <atioglxx.dll+0x40e0ed>)
~~Dr.M~~ # 2 vcllo.dll!OpenGLContext::InitGLEW                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:949]
~~Dr.M~~ # 3 vcllo.dll!OpenGLContext::ImplInit                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:866]
~~Dr.M~~ # 4 vcllo.dll!OpenGLContext::init                            [c:\lo\master\vcl\source\opengl\openglcontext.cxx:786]
~~Dr.M~~ # 5 vcllo.dll!WinOpenGLSalGraphicsImpl::CreateWinContext     [c:\lo\master\vcl\opengl\win\gdiimpl.cxx:36]

Turns out that in order to enable the GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
extension, the GL context must be created with WGL_CONTEXT_DEBUG_BIT_ARB
set. It seems that other drivers did not enforce this so far, but in
this case the driver just crashes without this.

Fix the problem by splitting out the debug setup part of InitGLEW() into
a new InitGLEWDebugging(), and at least on Windows call it only after
wglCreateContextAttribsARB() and wglMakeCurrent(). Additionally make
sure that in the debug case the necessary flag is passed to
wglCreateContextAttribsARB().

Conflicts:
	vcl/source/opengl/OpenGLContext.cxx

Change-Id: I6b77e0c06fd85fdae0386a0801f1de1838524586
Reviewed-on: https://gerrit.libreoffice.org/17750
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/18219
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
ghost pushed a commit that referenced this pull request Sep 19, 2015
At least with my AMD card, in case of SAL_FORCEGL=1 the startup crashes
quite early. DrMemory says:

~~Dr.M~~ Error #1: UNADDRESSABLE ACCESS: writing 0x00001414-0x00001415 1 byte(s)
~~Dr.M~~ # 0 atioglxx.dll!DrvPresentBuffers                          +0xd6ea6  (0x09a248f6 <atioglxx.dll+0x1248f6>)
~~Dr.M~~ # 1 atioglxx.dll!DrvPresentBuffers                          +0x3c069c (0x09d0e0ed <atioglxx.dll+0x40e0ed>)
~~Dr.M~~ # 2 vcllo.dll!OpenGLContext::InitGLEW                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:949]
~~Dr.M~~ # 3 vcllo.dll!OpenGLContext::ImplInit                        [c:\lo\master\vcl\source\opengl\openglcontext.cxx:866]
~~Dr.M~~ # 4 vcllo.dll!OpenGLContext::init                            [c:\lo\master\vcl\source\opengl\openglcontext.cxx:786]
~~Dr.M~~ # 5 vcllo.dll!WinOpenGLSalGraphicsImpl::CreateWinContext     [c:\lo\master\vcl\opengl\win\gdiimpl.cxx:36]

Turns out that in order to enable the GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
extension, the GL context must be created with WGL_CONTEXT_DEBUG_BIT_ARB
set. It seems that other drivers did not enforce this so far, but in
this case the driver just crashes without this.

Fix the problem by splitting out the debug setup part of InitGLEW() into
a new InitGLEWDebugging(), and at least on Windows call it only after
wglCreateContextAttribsARB() and wglMakeCurrent(). Additionally make
sure that in the debug case the necessary flag is passed to
wglCreateContextAttribsARB().

Conflicts:
	vcl/source/opengl/OpenGLContext.cxx

Change-Id: I6b77e0c06fd85fdae0386a0801f1de1838524586
Reviewed-on: https://gerrit.libreoffice.org/17750
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/18219
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
ghost pushed a commit that referenced this pull request Nov 14, 2015
Change-Id: If343746b6544d77fec76ee89351cd7262d1bf350
ghost pushed a commit that referenced this pull request Nov 16, 2015
Change-Id: If343746b6544d77fec76ee89351cd7262d1bf350
ghost pushed a commit that referenced this pull request Nov 30, 2015
Change-Id: If343746b6544d77fec76ee89351cd7262d1bf350
ghost pushed a commit that referenced this pull request Dec 4, 2015
Change-Id: If343746b6544d77fec76ee89351cd7262d1bf350
ghost pushed a commit that referenced this pull request Dec 22, 2015
...as reported by UBSan in CppunitTest_sw_filters_test:

> /sw/inc/format.hxx:110:73: runtime error: downcast of address 0x2af2d8024000 which does not point to an object of type 'const SwFormat'
> 0x2af2d8024000: note: object is of type 'SwModify'
>  f2 2a 00 00  70 33 2f 87 f2 2a 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
>               ^~~~~~~~~~~~~~~~~~~~~~~
>               vptr for 'SwModify'
>     #0 0x2af27bbe8083 in SwFormat::DerivedFrom() const /sw/inc/format.hxx:110:73
>     #1 0x2af27bbc8401 in SwFormat::Modify(SfxPoolItem const*, SfxPoolItem const*) /sw/source/core/attr/format.cxx:282:21
>     #2 0x2af27e9934a3 in SwFrameFormat::Modify(SfxPoolItem const*, SfxPoolItem const*) /sw/source/core/layout/atrfrm.cxx:2597:5
>     #3 0x2af27f8207d5 in SwTableBoxFormat::Modify(SfxPoolItem const*, SfxPoolItem const*) /sw/source/core/table/swtable.cxx:2353:5
>     #4 0x2af27bb9cd52 in SwClient::SwClientNotify(SwModify const&, SfxHint const&) /sw/source/core/attr/calbck.cxx:68:9
>     #5 0x2af27bba4bee in SwModify::CallSwClientNotify(SfxHint const&) const /sw/inc/calbck.hxx:349:9
>     #6 0x2af27bba290b in SwModify::ModifyBroadcast(SfxPoolItem const*, SfxPoolItem const*) /sw/inc/calbck.hxx:173:11
>     #7 0x2af27bb9fbc0 in SwModify::NotifyClients(SfxPoolItem const*, SfxPoolItem const*) /sw/source/core/attr/calbck.cxx:143:5
>     #8 0x2af27bb9e0e7 in SwModify::~SwModify() /sw/source/core/attr/calbck.cxx:101:5
>     #9 0x2af27bbc6bb4 in SwFormat::~SwFormat() /sw/source/core/attr/format.cxx:251:1
>     #10 0x2af27e98fdf3 in SwFrameFormat::~SwFrameFormat() /sw/source/core/layout/atrfrm.cxx:2534:1
>     #11 0x2af27e9900af in SwFrameFormat::~SwFrameFormat() /sw/source/core/layout/atrfrm.cxx:2525:1
>     #12 0x2af27cb1646e in SwDoc::~SwDoc() /sw/source/core/doc/docnew.cxx:592:5
>     #13 0x2af27cb1993f in SwDoc::~SwDoc() /sw/source/core/doc/docnew.cxx:385:1
>     #14 0x2af282d45bb0 in SwDocShell::RemoveLink() /sw/source/uibase/app/docshini.cxx:472:13
>     #15 0x2af282d43596 in SwDocShell::~SwDocShell() /sw/source/uibase/app/docshini.cxx:394:5
>     #16 0x2af282d45f46 in SwDocShell::~SwDocShell() /sw/source/uibase/app/docshini.cxx:384:1
>     #17 0x2af282d4637f in SwDocShell::~SwDocShell() /sw/source/uibase/app/docshini.cxx:384:1
>     #18 0x2af282d464c6 in virtual thunk to SwDocShell::~SwDocShell() /sw/source/uibase/app/docshini.cxx:383:13
>     #19 0x2af27420aade in SvRefBase::ReleaseRef() /include/tools/ref.hxx:138:29
>     #20 0x2af27420195a in tools::SvRef<SwDocShell>::~SvRef() /include/tools/ref.hxx:49:30
>     #21 0x2af2741f6663 in SwFiltersTest::filter(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) /sw/qa/core/filters-test.cxx:130:1
>     #22 0x2af2741f368e in SwFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) /sw/qa/core/filters-test.cxx:69:12
>     #23 0x2af29a05d1fb in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) /unotest/source/cpp/filters-test.cxx:129:20
>     #24 0x2af29a060741 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) /unotest/source/cpp/filters-test.cxx:154:5
>     #25 0x2af2741fa8fa in SwFiltersTest::testCVEs() /sw/qa/core/filters-test.cxx:174:5
>     #26 0x2af27421631d in CppUnit::TestCaller<SwFiltersTest>::runTest() /workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
>     #27 0x2af23644866d in CppUnit::TestCaseMethodFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
>     #28 0x2af24e66d0d6 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /test/source/vclbootstrapprotector.cxx:57:14
>     #29 0x2af236403bb7 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
>     #30 0x2af2458a1926 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:88:12
>     #31 0x2af236403bb7 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
>     #32 0x2af241b89d58 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16
>     #33 0x2af236403bb7 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
>     #34 0x2af23638b90c in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
>     #35 0x2af236403bb7 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:12
>     #36 0x2af2363ffb61 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:77:18
>     #37 0x2af2364c91c5 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::string const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:181:10
>     #38 0x2af2364451c6 in CppUnit::TestCase::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:5
>     #39 0x2af23644bc03 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:5
>     #40 0x2af23644ab6d in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
>     #41 0x2af23644bc03 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:5
>     #42 0x2af23644ab6d in CppUnit::TestComposite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3
>     #43 0x2af2365078c6 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:5
>     #44 0x2af2364c7049 in CppUnit::TestResult::runTest(CppUnit::Test*) /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:148:3
>     #45 0x2af236508e86 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::string const&) /workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:3
>     #46 0x501b3c in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:281:13
>     #47 0x4fc866 in sal_main() /sal/cppunittester/cppunittester.cxx:431:14
>     #48 0x4fa822 in main /sal/cppunittester/cppunittester.cxx:338:1
>     #49 0x2af2380d2af4 in __libc_start_main (/lib64/libc.so.6+0x21af4)
>     #50 0x4323c4 in _start (/workdir/LinkTarget/Executable/cppunittester+0x4323c4)

Change-Id: Ic1ff73d3184ad2cd97555b7a45fb205e9ec84ac6
ghost pushed a commit that referenced this pull request Feb 5, 2016
(5abe0ab).
6884f53 "default B2DRange ctor doesn't do what
I thought it did" had reverted it, but the fix there is apparently not enough
yet, <http://ci.libreoffice.org/job/lo_ubsan/165/console> still fails with

> /vcl/headless/svpgdi.cxx:1274:28: runtime error: value 1.79769e+308 is outside the range of representable values of type 'int'
>  #0 0x2b826285b4d3 in SvpSalGraphics::releaseCairoContext(_cairo*, bool, basegfx::B2DRange const&) const /vcl/headless/svpgdi.cxx:1274:28
>  #1 0x2b8262868c3b in SvpSalGraphics::drawPolyPolygon(basegfx::B2DPolyPolygon const&) /vcl/headless/svpgdi.cxx:899:5
>  #2 0x2b826286c6f6 in SvpSalGraphics::drawPolygon(unsigned int, SalPoint const*) /vcl/headless/svpgdi.cxx:551:5
>  #3 0x2b826179915c in SalGraphics::DrawPolygon(unsigned int, SalPoint const*, OutputDevice const*) /vcl/source/gdi/salgdilayout.cxx:419:9
>  #4 0x2b82604d6f5a in OutputDevice::DrawEllipse(Rectangle const&) /vcl/source/outdev/curvedshapes.cxx:67:13
>  #5 0x2b8261f02c4d in CircType::Draw(OutputDevice&) /vcl/source/filter/sgvmain.cxx:596:13
>  #6 0x2b8261f0ddc6 in DrawObjkList(SvStream&, OutputDevice&) /vcl/source/filter/sgvmain.cxx:698:100
>  #7 0x2b8261f1462a in SgfFilterSDrw(SvStream&, SgfHeader&, SgfEntry&, GDIMetaFile&) /vcl/source/filter/sgvmain.cxx:820:26
>  #8 0x2b8261f16726 in SgfSDrwFilter(SvStream&, GDIMetaFile&, INetURLObject const&) /vcl/source/filter/sgvmain.cxx:858:22
>  #9 0x2b8261e48f33 in GraphicFilter::ImportGraphic(Graphic&, rtl::OUString const&, SvStream&, unsigned short, unsigned short*, GraphicFilterImportFlags, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>*, WMF_EXTERNALHEADER*) /vcl/source/filter/graphicfilter.cxx:1670:30
>  #10 0x2b8261e3c85a in GraphicFilter::ImportGraphic(Graphic&, rtl::OUString const&, SvStream&, unsigned short, unsigned short*, GraphicFilterImportFlags, WMF_EXTERNALHEADER*) /vcl/source/filter/graphicfilter.cxx:1314:12
>  #11 0x2b827bb9fee3 in VclFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) /vcl/qa/cppunit/graphicfilter/filters-test.cxx:60:12
[...]

Change-Id: Icb8f52414f57f08334fc501842b3f75c1d3642eb
ghost pushed a commit that referenced this pull request Apr 6, 2016
At least the checkTitleNumbers(complex.XTitle.CheckXTitle) in
JunitTest_framework_complex triggered the UBSan failure

> sw/source/uibase/uiview/pview.cxx:1139:25: runtime error: downcast of address 0x61300047e500 which does not point to an object of type 'SwEditShell'
> 0x61300047e500: note: object is of type 'SwViewShell'
>  d3 03 80 0d  10 f6 8e e0 fa 2a 00 00  80 b2 1b 00 90 61 00 00  80 b2 1b 00 90 61 00 00  00 00 00 00
>               ^~~~~~~~~~~~~~~~~~~~~~~
>               vptr for 'SwViewShell'
>     #0 0x2afadd5b9594 in SwPagePreview::Init() sw/source/uibase/uiview/pview.cxx:1139:25
>     #1 0x2afadd5c0e29 in SwPagePreview::SwPagePreview(SfxViewFrame*, SfxViewShell*) sw/source/uibase/uiview/pview.cxx:1251:5
>     #2 0x2afadd58c7a5 in SwPagePreview::CreateInstance(SfxViewFrame*, SfxViewShell*) sw/source/uibase/uiview/pview.cxx:85:1
>     #3 0x2afa4a476c8c in SfxViewFactory::CreateInstance(SfxViewFrame*, SfxViewShell*) sfx2/source/view/viewfac.cxx:28:12
>     #4 0x2afa49b677a5 in SfxBaseModel::createViewController(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&) sfx2/source/doc/sfxbasemodel.cxx:4255:32
>     #5 0x2afa49b6ac45 in non-virtual thunk to SfxBaseModel::createViewController(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&) sfx2/source/doc/sfxbasemodel.cxx:4217:57
>     #6 0x2afa4a38bd08 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:600:50
>     #7 0x2afa4a37f627 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:728:13
>     #8 0x2afac3723d1a in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1117:24
>     #9 0x2afac3707b02 in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:379:20
>     #10 0x2afac37007d5 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:165:9
>     #11 0x2afac396848d in (anonymous namespace)::Frame::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/frame.cxx:608:12
>     #12 0x2afac39a369a in non-virtual thunk to (anonymous namespace)::Frame::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) framework/source/services/frame.cxx:587:62
>     #13 0x2afa4a4cdd1a in SfxViewFrame::LoadViewIntoFrame_Impl(SfxObjectShell const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, unsigned short, bool) sfx2/source/view/viewfrm.cxx:1897:5
>     #14 0x2afa4a501df3 in SfxViewFrame::SwitchToViewShell_Impl(unsigned short, bool) sfx2/source/view/viewfrm.cxx:2096:32
>     #15 0x2afa4a4a7491 in SfxViewFrame::ExecView_Impl(SfxRequest&) sfx2/source/view/viewfrm.cxx:2181:29
>     #16 0x2afa4a4a5d16 in SfxStubSfxViewFrameExecView_Impl(SfxShell*, SfxRequest&) workdir/SdiTarget/sfx2/sdi/sfxslots.hxx:709:1
>     #17 0x2afa483dfe06 in SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) include/sfx2/shell.hxx:204:35
>     #18 0x2afa48392c56 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) sfx2/source/control/dispatch.cxx:262:13
>     #19 0x2afa483bf830 in SfxDispatcher::PostMsgHandler(SfxRequest*) sfx2/source/control/dispatch.cxx:1085:17
>     #20 0x2afa48398545 in SfxDispatcher::LinkStubPostMsgHandler(void*, SfxRequest*) sfx2/source/control/dispatch.cxx:1065:1
>     #21 0x2afa49d320a7 in Link<SfxRequest*, void>::Call(SfxRequest*) const include/tools/link.hxx:84:45
>     #22 0x2afa49d31b50 in SfxHintPoster::DoEvent_Impl(void*) sfx2/source/notify/hintpost.cxx:44:5
>     #23 0x2afa49d319e5 in SfxHintPoster::LinkStubDoEvent_Impl(void*, void*) sfx2/source/notify/hintpost.cxx:42:1
>     #24 0x2afa69f03327 in Link<void*, void>::Call(void*) const include/tools/link.hxx:84:45
>     #25 0x2afa69eec39f in ImplHandleUserEvent(ImplSVEvent*) vcl/source/window/winproc.cxx:1959:13
>     #26 0x2afa69ed7183 in ImplWindowFrameProc(vcl::Window*, unsigned short, void const*) vcl/source/window/winproc.cxx:2527:13
>     #27 0x2afa6cf9a0f9 in SalFrame::CallCallback(unsigned short, void const*) const vcl/inc/salframe.hxx:273:33
>     #28 0x2afa6cff0a85 in SvpSalInstance::DoYield(bool, bool, unsigned long) vcl/headless/svpinst.cxx:293:17
>     #29 0x2afa6c484a64 in ImplYield(bool, bool, unsigned long) vcl/source/app/svapp.cxx:509:9
>     #30 0x2afa6c45ed83 in Application::Yield() vcl/source/app/svapp.cxx:553:5
>     #31 0x2afa6c45eb1a in Application::Execute() vcl/source/app/svapp.cxx:473:9
>     #32 0x2afa38280294 in desktop::Desktop::DoExecute() desktop/source/app/app.cxx:1322:5
>     #33 0x2afa3828ada3 in desktop::Desktop::Main() desktop/source/app/app.cxx:1647:17
>     #34 0x2afa6c4de08e in ImplSVMain() vcl/source/app/svmain.cxx:172:19
>     #35 0x2afa6c4eb776 in SVMain() vcl/source/app/svmain.cxx:210:16
>     #36 0x2afa384c5d01 in soffice_main desktop/source/app/sofficemain.cxx:135:12
>     #37 0x4f0f0c in sal_main desktop/source/app/main.c:48:15
>     #38 0x4f0ee6 in main desktop/source/app/main.c:47:1
>     #39 0x2afa39e4c57f in __libc_start_main (/lib64/libc.so.6+0x2057f)
>     #40 0x418f48 in _start (instdir/program/soffice.bin+0x418f48)

Change-Id: I4a32bcf4dea4616d4726c28ba01adba9083ad1c6
ghost pushed a commit that referenced this pull request Apr 6, 2016
At least JunitTest_framework_copmlex triggered the UBSan failure

> vcl/headless/svpgdi.cxx:924:46: runtime error: division by zero
>     #0 0x2b7114500e3b in renderSource(_cairo*, SalTwoRect const&, _cairo_surface*) vcl/headless/svpgdi.cxx:924:46
>     #1 0x2b711450074c in SvpSalGraphics::copySource(SalTwoRect const&, _cairo_surface*) vcl/headless/svpgdi.cxx:937:33
>     #2 0x2b7114501f37 in SvpSalGraphics::copyBits(SalTwoRect const&, SalGraphics*) vcl/headless/svpgdi.cxx:980:5
>     #3 0x2b7113461871 in SalGraphics::CopyBits(SalTwoRect const&, SalGraphics*, OutputDevice const*, OutputDevice const*) vcl/source/gdi/salgdilayout.cxx:529:9
>     #4 0x2b711359a1fc in VirtualDevice::InnerImplSetOutputSizePixel(Size const&, bool, unsigned char*) vcl/source/gdi/virdev.cxx:352:17
>     #5 0x2b711359bef6 in VirtualDevice::ImplSetOutputSizePixel(Size const&, bool, unsigned char*) vcl/source/gdi/virdev.cxx:391:9
>     #6 0x2b711359edc0 in VirtualDevice::SetOutputSizePixel(Size const&, bool) vcl/source/gdi/virdev.cxx:437:12
>     #7 0x2b70fa4b6f3f in sdr::overlay::OverlayManagerBuffered::ImpPrepareBufferDevice() svx/source/sdr/overlay/overlaymanagerbuffered.cxx:45:17
>     #8 0x2b70fa4c0c2c in sdr::overlay::OverlayManagerBuffered::ImpSaveBackground(vcl::Region const&, OutputDevice*) svx/source/sdr/overlay/overlaymanagerbuffered.cxx:159:13
>     #9 0x2b70fa4cecab in sdr::overlay::OverlayManagerBuffered::completeRedraw(vcl::Region const&, OutputDevice*) const svx/source/sdr/overlay/overlaymanagerbuffered.cxx:414:17
>     #10 0x2b70fa787fc4 in SdrPaintWindow::DrawOverlay(vcl::Region const&) svx/source/svdraw/sdrpaintwindow.cxx:334:13
>     #11 0x2b70fb9d388f in SdrPaintView::EndCompleteRedraw(SdrPaintWindow&, bool) svx/source/svdraw/svdpntv.cxx:753:9
>     #12 0x2b70fd77da81 in FmFormView::EndCompleteRedraw(SdrPaintWindow&, bool) svx/source/form/fmview.cxx:474:5
>     #13 0x2b70fb9d64a0 in SdrPaintView::EndDrawLayers(SdrPaintWindow&, bool) svx/source/svdraw/svdpntv.cxx:789:5
>     #14 0x2b7182085fe9 in SwViewShell::DLPostPaint2(bool) sw/source/core/view/viewsh.cxx:240:9
>     #15 0x2b71820d94c5 in SwViewShell::Paint(OutputDevice&, Rectangle const&) sw/source/core/view/viewsh.cxx:1797:21
>     #16 0x2b717c26e635 in SwCursorShell::Paint(OutputDevice&, Rectangle const&) sw/source/core/crsr/crsrsh.cxx:1273:5
>     #17 0x2b71839ae182 in SwEditWin::Paint(OutputDevice&, Rectangle const&) sw/source/uibase/docvw/edtwin2.cxx:475:9
>     #18 0x2b71100ee7e0 in PaintHelper::DoPaint(vcl::Region const*) vcl/source/window/paint.cxx:309:13
>     #19 0x2b71100ff14a in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:611:9
>     #20 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
>     #21 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
>     #22 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
>     #23 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
>     #24 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
>     #25 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
>     #26 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
>     #27 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
>     #28 0x2b71100fb252 in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:549:17
>     #29 0x2b71100ff463 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:614:1
>     #30 0x2b7110100536 in vcl::Window::ImplCallOverlapPaint() vcl/source/window/paint.cxx:635:9
>     #31 0x2b7110102811 in vcl::Window::ImplHandlePaintHdl(Idle*) vcl/source/window/paint.cxx:667:9
>     #32 0x2b7110100ee7 in vcl::Window::LinkStubImplHandlePaintHdl(void*, Idle*) vcl/source/window/paint.cxx:645:1
>     #33 0x2b71101446d7 in Link<Idle*, void>::Call(Idle*) const include/tools/link.hxx:84:45
>     #34 0x2b711380dff9 in Idle::Invoke() vcl/source/app/idle.cxx:25:5
>     #35 0x2b711385011b in ImplSchedulerData::Invoke() vcl/source/app/scheduler.cxx:45:5
>     #36 0x2b71138535e5 in Scheduler::ProcessTaskScheduling(bool) vcl/source/app/scheduler.cxx:177:9
>     #37 0x2b71139a90d4 in ImplYield(bool, bool, unsigned long) vcl/source/app/svapp.cxx:521:5
>     #38 0x2b7113982d83 in Application::Yield() vcl/source/app/svapp.cxx:553:5
>     #39 0x2b7113982b1a in Application::Execute() vcl/source/app/svapp.cxx:473:9
>     #40 0x2b70df7a4294 in desktop::Desktop::DoExecute() desktop/source/app/app.cxx:1322:5
>     #41 0x2b70df7aeda3 in desktop::Desktop::Main() desktop/source/app/app.cxx:1647:17
>     #42 0x2b7113a0208e in ImplSVMain() vcl/source/app/svmain.cxx:172:19
>     #43 0x2b7113a0f776 in SVMain() vcl/source/app/svmain.cxx:210:16
>     #44 0x2b70df9e9d01 in soffice_main desktop/source/app/sofficemain.cxx:135:12
>     #45 0x4f0f0c in sal_main desktop/source/app/main.c:48:15
>     #46 0x4f0ee6 in main desktop/source/app/main.c:47:1
>     #47 0x2b70e137057f in __libc_start_main (/lib64/libc.so.6+0x2057f)
>     #48 0x418f48 in _start (instdir/program/soffice.bin+0x418f48)

Change-Id: I2bc4abe48c129e006582b9870229f44d2d2bb1ed
ghost pushed a commit that referenced this pull request Apr 6, 2016
...as happened at least once in JunitTest_framework_copmlex with

> Thread 27 (Thread 0x2ac7e60d1700 (LWP 30831)):
> #0  0x00002ac7b781c89d in __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
> #1  0x00002ac7b7816a36 in __GI___pthread_mutex_lock (mutex=0x1ce1720) at ../nptl/pthread_mutex_lock.c:116
> #2  0x00002ac7b6e6b257 in osl_acquireMutex(oslMutexImpl*) (pMutex=0x1ce1720) at sal/osl/unx/mutex.cxx:99
> #3  0x00002ac7bf928098 in osl::Mutex::acquire() (this=0x1ce16f8) at include/osl/mutex.hxx:56
> #4  0x00002ac7c022d123 in SalYieldMutex::acquire() (this=0x1ce16f0) at vcl/unx/generic/app/geninst.cxx:54
> #5  0x00002ac7e48442ab in SolarMutexGuard::SolarMutexGuard() (this=0x2ac7e60cedb0) at include/vcl/svapp.hxx:1476
> #6  0x00002ac7e4aa7747 in framework::AddonsToolBarWrapper::dispose() (this=0x2ac7e7fbcd50) at framework/source/uielement/addonstoolbarwrapper.cxx:73
> #7  0x00002ac7e4947503 in framework::ToolbarLayoutManager::destroyToolbars() (this=0x2ac7dbf88018) at framework/source/layoutmanager/toolbarlayoutmanager.cxx:654
> #8  0x00002ac7e494364c in framework::ToolbarLayoutManager::reset() (this=0x2ac7dbf88018) at framework/source/layoutmanager/toolbarlayoutmanager.cxx:363
> #9  0x00002ac7e492a1d6 in framework::LayoutManager::implts_reset(bool) (this=0x2ac7dbfbcc40, bAttached=false) at framework/source/layoutmanager/layoutmanager.cxx:414
> #10 0x00002ac7e493a404 in framework::LayoutManager::frameAction(com::sun::star::frame::FrameActionEvent const&) (this=0x2ac7dbfbcc40, aEvent=...) at framework/source/layoutmanager/layoutmanager.cxx:2807
> #11 0x00002ac7e49e57dc in (anonymous namespace)::Frame::implts_sendFrameActionEvent(com::sun::star::frame::FrameAction const&) (this=0x2ac7e7fb2050, aAction=@0x2ac7e60cf73c: com::sun::star::frame::FrameAction_COMPONENT_DETACHING) at framework/source/services/frame.cxx:2845
> #12 0x00002ac7e49ded07 in (anonymous namespace)::Frame::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) (this=0x2ac7e7fb2050, xComponentWindow=empty uno::Reference, xController=empty uno::Reference) at framework/source/services/frame.cxx:1509
> #13 0x00002ac7e49e293b in (anonymous namespace)::Frame::close(unsigned char) (this=0x2ac7e7fb2050, bDeliverOwnership=0 '\000') at framework/source/services/frame.cxx:1770
> #14 0x00002ac7e49ce635 in framework::Desktop::impl_closeFrames(bool) (this=0x2ac7daf2f430, bAllowUI=true) at framework/source/services/desktop.cxx:1674
> #15 0x00002ac7e49cd6ee in framework::Desktop::terminate() (this=0x2ac7daf2f430) at framework/source/services/desktop.cxx:238
> #16 0x00002ac7da45deb4 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) (pThis=0x2ac7daf2f4a0, nVtableIndex=3, pRegisterReturn=0x2ac7f41b36d0, pReturnTypeRef=0x1ce84c0, bSimpleReturn=true, pStack=0x2ac7e60cfd00, nStack=0, pGPR=0x2ac7e60cffc0, pFPR=0x2ac7e60cff80) at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77
> #17 0x00002ac7da45cccf in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) (pThis=0x2ac7f40f0ea0, aVtableSlot=..., pReturnTypeRef=0x1ce84c0, nParams=0, pParams=0x0, pUnoReturn=0x2ac7f41b36d0, pUnoArgs=0x0, ppUnoExc=0x2ac7e60d0560) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:241
> #18 0x00002ac7da45c459 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(_uno_Interface*, _typelib_TypeDescription const*, void*, void**, _uno_Any**) (pUnoI=0x2ac7f40f0ea0, pMemberDescr=0x2ac7f00027c0, pReturn=0x2ac7f41b36d0, pArgs=0x0, ppException=0x2ac7e60d0560) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:430
> #19 0x00002ac7e40401ea in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const (this=0x2ac7f0002870, returnValue=0x2ac7e60d09d0, outArguments=0x2ac7e60d0998) at binaryurp/source/incomingrequest.cxx:239
> #20 0x00002ac7e403e88b in binaryurp::IncomingRequest::execute() const (this=0x2ac7f0002870) at binaryurp/source/incomingrequest.cxx:73
> #21 0x00002ac7e406927d in request(void*) (pThreadSpecificData=0x2ac7f0002870) at binaryurp/source/reader.cxx:83
> #22 0x00002ac7b998953b in cppu_threadpool::JobQueue::enter(long, bool) (this=0x2ac7f0002d30, nDisposeId=47038213394384, bReturnWhenNoJob=true) at cppu/source/threadpool/jobqueue.cxx:107
> #23 0x00002ac7b998dc25 in cppu_threadpool::ORequestThread::run() (this=0x2ac7f0000fd0) at cppu/source/threadpool/thread.cxx:165
> #24 0x00002ac7b998fb0e in threadFunc(void*) (param=0x2ac7f0000fe0) at include/osl/thread.hxx:185
> #25 0x00002ac7b6e8190b in osl_thread_start_Impl(void*) (pData=0x2ac7f0001020) at sal/osl/unx/thread.cxx:240
> #26 0x00002ac7b781460a in start_thread (arg=0x2ac7e60d1700) at pthread_create.c:334
> #27 0x00002ac7b754ea4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

> Thread 1 (Thread 0x2ac7b6cf7340 (LWP 30697)):
> #0  0x00002ac7b7819b10 in pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
> #1  0x00002ac7b6e5b316 in osl_waitCondition(oslCondition, TimeValue const*) (Condition=0x2ac7f41e10b0, pTimeout=0x0) at sal/osl/unx/conditn.cxx:228
> #2  0x00002ac7cca51370 in osl::Condition::wait(TimeValue const*) (this=0x2ac7e7fb20d8, pTimeout=0x0) at include/osl/conditn.hxx:84
> #3  0x00002ac7cca50f90 in framework::Gate::wait() (this=0x2ac7e7fb20d0) at framework/inc/threadhelp/gate.hxx:123
> #4  0x00002ac7cca50708 in framework::TransactionManager::setWorkingMode(framework::EWorkingMode) (this=0x2ac7e7fb20c8, eMode=framework::E_BEFORECLOSE) at framework/source/fwi/threadhelp/transactionmanager.cxx:98
> #5  0x00002ac7e49dfc3c in (anonymous namespace)::Frame::dispose() (this=0x2ac7e7fb2050) at framework/source/services/frame.cxx:2008
> #6  0x00002ac7e49e2cd3 in (anonymous namespace)::Frame::close(unsigned char) (this=0x2ac7e7fb2050, bDeliverOwnership=1 '\001') at framework/source/services/frame.cxx:1801
> #7  0x00002ac7bbbe25fe in SfxViewFrame::Exec_Impl(SfxRequest&) (this=0x2ac7f4691cd0, rReq=...) at sfx2/source/view/viewfrm2.cxx:260
> #8  0x00002ac7bbbcd658 in SfxStubSfxViewFrameExec_Impl(SfxShell*, SfxRequest&) (pShell=0x2ac7f4691cd0, rReq=...) at workdir/SdiTarget/sfx2/sdi/sfxslots.hxx:706
> #9  0x00002ac7bb71f792 in SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) (this=0x2ac7f4691cd0, pFunc=0x2ac7bbbcd630 <SfxStubSfxViewFrameExec_Impl(SfxShell*, SfxRequest&)>, rReq=...) at include/sfx2/shell.hxx:204
> #10 0x00002ac7bb715e41 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=0x2ac7f40fe8e0, rShell=..., rSlot=..., rReq=..., bRecord=true) at sfx2/source/control/dispatch.cxx:262
> #11 0x00002ac7bb71b6fd in SfxDispatcher::PostMsgHandler(SfxRequest*) (this=0x2ac7f40fe8e0, pReq=0x2ac88c000cf0) at sfx2/source/control/dispatch.cxx:1085
> #12 0x00002ac7bb716698 in SfxDispatcher::LinkStubPostMsgHandler(void*, SfxRequest*) (instance=0x2ac7f40fe8e0, data=0x2ac88c000cf0) at sfx2/source/control/dispatch.cxx:1065
> #13 0x00002ac7bbabb3f8 in Link<SfxRequest*, void>::Call(SfxRequest*) const (this=0x2ac7f48361f0, data=0x2ac88c000cf0) at include/tools/link.hxx:84
> #14 0x00002ac7bbabb37b in SfxHintPoster::DoEvent_Impl(void*) (this=0x2ac7f48361e0, pPostedHint=0x2ac88c000cf0) at sfx2/source/notify/hintpost.cxx:44
> #15 0x00002ac7bbabb348 in SfxHintPoster::LinkStubDoEvent_Impl(void*, void*) (instance=0x2ac7f48361e0, data=0x2ac88c000cf0) at sfx2/source/notify/hintpost.cxx:42
> #16 0x00002ac7bfaba968 in Link<void*, void>::Call(void*) const (this=0x2ac88c00b008, data=0x2ac88c000cf0) at include/tools/link.hxx:84
> #17 0x00002ac7bfab7adc in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x2ac88c00b000) at vcl/source/window/winproc.cxx:1956
> #18 0x00002ac7bfab4db7 in ImplWindowFrameProc(vcl::Window*, unsigned short, void const*) (_pWindow=0x2a43020, nEvent=22, pEvent=0x2ac88c00b000) at vcl/source/window/winproc.cxx:2524
> #19 0x00002ac7c01278c9 in SalFrame::CallCallback(unsigned short, void const*) const (this=0x2a43890, nEvent=22, pEvent=0x2ac88c00b000) at vcl/inc/salframe.hxx:273
> #20 0x00002ac7c0133999 in SvpSalInstance::DoYield(bool, bool, unsigned long) (this=0x1ce1640, bWait=false, bHandleAllCurrentEvents=false, nReleased=0) at vcl/headless/svpinst.cxx:293
> #21 0x00002ac7bffa63b5 in ImplYield(bool, bool, unsigned long) (i_bWait=false, i_bAllEvents=false, nReleased=0) at vcl/source/app/svapp.cxx:509
> #22 0x00002ac7bffa1148 in Application::Yield() () at vcl/source/app/svapp.cxx:553
> #23 0x00002ac7bffa10d3 in Application::Execute() () at vcl/source/app/svapp.cxx:473
> #24 0x00002ac7b70ee229 in desktop::Desktop::DoExecute() () at desktop/source/app/app.cxx:1322
> #25 0x00002ac7b70f0304 in desktop::Desktop::Main() (this=0x7ffefac27e38) at desktop/source/app/app.cxx:1647
> #26 0x00002ac7bffb3639 in ImplSVMain() () at vcl/source/app/svmain.cxx:172
> #27 0x00002ac7bffb4e18 in SVMain() () at vcl/source/app/svmain.cxx:210
> #28 0x00002ac7b714f3b5 in soffice_main() () at desktop/source/app/sofficemain.cxx:135
> #29 0x000000000040097d in sal_main () at desktop/source/app/main.c:48
> #30 0x0000000000400957 in main (argc=8, argv=0x7ffefac27fe8) at desktop/source/app/main.c:47

Change-Id: Id06a8fcfe449f566785c51174b1ad3e81459032f
ghost pushed a commit that referenced this pull request Jun 14, 2016
Otherwise the following can happen:

- view #0 is created
- view #1 is created
- view #1 changes part, so lok_doc_view_reset_view() gets called
- view #1 calls postMouseEvent(), but claims it happened on view #0

Also log all setView() calls in the widget.

Change-Id: Iefcf82d9396b2af75586e79dde59998320f41d60
Reviewed-on: https://gerrit.libreoffice.org/26245
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
ghost pushed a commit that referenced this pull request Jun 30, 2016
…hange

Steps to reproduce in gtktiledviewer:

- two windows, then enable edit in both
- view #0: go inside a word
- view #1: select the same word
- press Del in view #1 -> no invalidation

Fix the problem by changing the LOK-specific GetPageNum() call in
SwVisibleCursor::SetPosAndShow(), so that it doesn't re-calculate the
frame, that way later when SwLayAction::TurboAction_() attempts to
re-calculate the layout, then the frame will be still invalid, and that
re-calculation then triggers the necessary invalidations.

Change-Id: I8c4472b9809537fcbd4a20c73f39be7ebca16b1f
Reviewed-on: https://gerrit.libreoffice.org/26802
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
ghost pushed a commit that referenced this pull request Jul 13, 2016
Otherwise the following can happen:

- view #0 is created
- view #1 is created
- view #1 changes part, so lok_doc_view_reset_view() gets called
- view #1 calls postMouseEvent(), but claims it happened on view #0

Also log all setView() calls in the widget.

Change-Id: Iefcf82d9396b2af75586e79dde59998320f41d60
Reviewed-on: https://gerrit.libreoffice.org/26245
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 60e5796)
ghost pushed a commit that referenced this pull request Jul 21, 2016
…hange

Steps to reproduce in gtktiledviewer:

- two windows, then enable edit in both
- view #0: go inside a word
- view #1: select the same word
- press Del in view #1 -> no invalidation

Fix the problem by changing the LOK-specific GetPageNum() call in
SwVisibleCursor::SetPosAndShow(), so that it doesn't re-calculate the
frame, that way later when SwLayAction::TurboAction_() attempts to
re-calculate the layout, then the frame will be still invalid, and that
re-calculation then triggers the necessary invalidations.

Change-Id: I8c4472b9809537fcbd4a20c73f39be7ebca16b1f
Reviewed-on: https://gerrit.libreoffice.org/26802
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 6168f10)
ghost pushed a commit that referenced this pull request Aug 12, 2016
I'm currently unable to invalidate / update the correct cache to
make the changed SwPageDesc visible to SwRootFrm::AssertFlyPages.

Instead this continues to use the SwWrtShell::InsertPageBreak,
which moves the cursor to the new page, which somehow triggers the
SwCrsrShell to update the (probably?) cached layout information.

The working backtrace looks like this. while the "broken" one
stops at #16, because the cursor has a valid paragraph.

 #0  SwFrm::WrongPageDesc(SwPageFrm*)
 #1  SwFrm::GetNextLeaf(MakePageType)
 #2  SwFrm::GetLeaf(MakePageType, bool)
 #3  SwFlowFrm::MoveFwd(bool, bool, bool)
 #4  SwContentFrm::MakeAll(OutputDevice*)
 #5  SwFrm::PrepareMake(OutputDevice*)
 #6  SwFrm::Calc(OutputDevice*) const
 #7  SwTextFrm::CalcFollow(int)
 #8  SwTextFrm::_AdjustFollow(SwTextFormatter&, int, int, unsigned char)
 #9  SwTextFrm::FormatAdjust(SwTextFormatter&, WidowsAndOrphans&, int, bool)
 #10 SwTextFrm::_Format(SwTextFormatter&, SwTextFormatInfo&, bool)
 #11 SwTextFrm::_Format(OutputDevice*, SwParaPortion*)
 #12 SwTextFrm::Format(OutputDevice*, SwBorderAttrs const*)
 #13 SwContentFrm::MakeAll(OutputDevice*)
 #14 SwFrm::PrepareMake(OutputDevice*)
 #15 SwFrm::Calc(OutputDevice*) const
 #16 SwTextFrm::GetFormatted(bool)
 #17 SwTextFrm::GetCharRect(SwRect&, SwPosition const&, SwCrsrMoveState*) const
 #18 SwCrsrShell::UpdateCrsr(unsigned short, bool)
 #19 SwCrsrShell::EndAction(bool, bool)
 #20 SwEditShell::EndAllAction()
 #21 SwDoc::AppendDoc(SwDoc const&, unsigned short, SwPageDesc*, bool, int)
 #22 SwDBManager::MergeMailFiles(SwWrtShell*, SwMergeDescriptor const&, vcl::Window*)
 #23 SwDBManager::MergeNew(SwMergeDescriptor const&, vcl::Window*)

Have a look at the SwPageDesc with by toggling the #if 0 block
with log:

SAL_LOG="-INFO-WARN+INFO.sw.docappend+INFO.sw.createcopy+INFO.sw.pagefrm"

Change-Id: I02f955a6be00a3b57d50d18d4da3651cb9473614
ghost pushed a commit that referenced this pull request Sep 1, 2016
I'm not sure how to trigger this reliably, but Pranav got this:

	#0  0x00007fb2f471bbf0 in SfxLokHelper::getView(SfxViewShell*) (pViewShell=0x0) at sfx2/source/view/lokhelper.cxx:82
	#1  0x00007fb2f75edf4f in doc_paintPartTile(LibreOfficeKitDocument*, unsigned char*, int, int, int, int, int, int, int) (pThis=0x7fb290253c40, pBuffer=0x281fbd0 "", nPart=0, nCanvasWidth=1024, nCanvasHeight=256, nTilePosX=0, nTilePosY=11520, nTileWidth=15360, nTileHeight=3840) at desktop/source/lib/init.cxx:1338

Given that SfxViewShell::Current() may indeed return nullptr (e.g.
during shutdown), change SfxLokHelper::getView() to return -1 in that
case, and adapt client code to handle that.

Change-Id: Ia191c843c8a993f3d7157de432af57964c0a8f63
Reviewed-on: https://gerrit.libreoffice.org/28583
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request Aug 26, 2024
Seen while running the online.git unit-quarantine testcase:

	#0  std::__uniq_ptr_impl<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::_M_ptr() const (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:191
	#1  0x00007f2f25fa398a in std::unique_ptr<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::get() const (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:462
	#2  0x00007f2f25f9fae2 in std::unique_ptr<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::operator->() const (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:455
	#3  0x00007f2f25f8bbd2 in SfxMedium::GetFilter() const (this=0x0) at sfx2/source/doc/docfile.cxx:3272
	#4  0x00007f2f260067ce in SfxObjectShell::IsHelpDocument() const (this=0x5c6adc0) at sfx2/source/doc/objcont.cxx:589
	#5  0x00007f2f0f6991c1 in SwLayIdle::isJobEnabled(IdleJobType, SwViewShell const*) (eJob=IdleJobType::SMART_TAGS, pViewShell=0x5a573f0)
	    at sw/source/core/layout/layact.cxx:2218
	#6  0x00007f2f0f69926d in SwLayIdle::DoIdleJob(IdleJobType, IdleJobArea) (this=0x7ffc9daf4180, eJob=IdleJobType::SMART_TAGS, eJobArea=IdleJobArea::VISIBLE)
	    at sw/source/core/layout/layact.cxx:2234
	#7  0x00007f2f0f699d81 in SwLayIdle::SwLayIdle(SwRootFrame*, SwViewShellImp*) (this=0x7ffc9daf4180, pRt=0x5a8fad0, pI=0x5a58860)
	    at sw/source/core/layout/layact.cxx:2355
	#8  0x00007f2f0fdccf21 in SwViewShell::LayoutIdle() (this=0x5a573f0) at sw/source/core/view/viewsh.cxx:826

Assume that in case the object shell has no underlying medium, then
that's not a help document.

Also fix the higher level problem that the LOK AnyInput callback should
not be invoked while doing a LOK background save, as the object shell in the
forked process has no underlying medium. That fixes the failure seen
while running the online.git unit-save-torture test.

(cherry picked from commit 3974af7)

Change-Id: Idcdd62cc177ac4b7edfbcef8906da2e42610ee98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172377
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Aug 27, 2024
==10765==WARNING: MemorySanitizer: use-of-uninitialized-value
 #0 0x5a74216f620b in _cairo_path_fixed_fill_rectilinear_tessellate_to_boxes workdir/UnpackedTarball/cairo/src/cairo-path-fill.c:288:5
 #1 0x5a74216f620b in _cairo_path_fixed_fill_rectilinear_to_boxes workdir/UnpackedTarball/cairo/src/cairo-path-fill.c:345:12
 #2 0x5a7421735497 in _cairo_spans_compositor_fill workdir/UnpackedTarball/cairo/src/cairo-spans-compositor.c:1121:11

num_limits is 0 here so this is apparently cosmetic

Change-Id: Ib07259ce653414c9381c800355a648ab025d1919
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172457
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Aug 30, 2024
Creating or modifying native Qt UI elements needs
to happen in the main thread.

This commit takes care of the obvious cases where
such interaction happens.

Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:

    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 958
    terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

    Fatal exception: Signal 6
    Stack:
    #0 sal::backtrace_get(unsigned int) at /home/michi/development/git/libreoffice/sal/osl/unx/backtraceapi.cxx:42
    #1 (anonymous namespace)::printStack(int) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:289
    #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:330
    #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:427
    #4 /lib/x86_64-linux-gnu/libc.so.6(+0x3f590) [0x7fdb05455590]
    #5 __pthread_kill_implementation at ./nptl/pthread_kill.c:44 (discriminator 1)
    #6 raise at ./signal/../sysdeps/posix/raise.c:27
    #7 abort at ./stdlib/abort.c:81
    #8 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xa1a3d) [0x7fdb050a1a3d]
    #9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
    #10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
    #11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
    #12 QMessageLogger::fatal() const at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:901
    #13 qt_assert_x(char const*, char const*, char const*, int) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:0
    #14 QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:959
    #15 QWidget::QWidget(QWidgetPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:878
    #16 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
    #17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
    #18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
    #19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
    #20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
    #21 dp_gui::(anonymous namespace)::ProgressCmdEnv::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:477
    #22 dp_misc::interactContinuation(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, bool*, bool*) at /home/michi/development/git/libreoffice/desktop/source/deployment/misc/dp_interact.cxx:114
    #23 dp_manager::ExtensionManager::checkInstall(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:1315
    #24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
    #25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:655
    #26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:0
    #27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
    #28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
    #29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
    #30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
    #31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
    #32 start_thread at ./nptl/pthread_create.c:447
    #33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80

Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Aug 30, 2024
Besides the obvious cases handled in previous commit

    Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Fri Aug 30 10:12:21 2024 +0200

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

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

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

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

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

Change-Id: Idb5b20bde8c306ed14efd5467887d55fdf470202
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172643
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
tdf-gerrit pushed a commit that referenced this pull request Aug 31, 2024
Creating or modifying native Qt UI elements needs
to happen in the main thread.

This commit takes care of the obvious cases where
such interaction happens.

Otherwise, the tdf#162696 scenario triggers asserts
like the following with a Qt debug build:

    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 958
    terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

    Fatal exception: Signal 6
    Stack:
    #0 sal::backtrace_get(unsigned int) at /home/michi/development/git/libreoffice/sal/osl/unx/backtraceapi.cxx:42
    #1 (anonymous namespace)::printStack(int) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:289
    #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:330
    #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:427
    #4 /lib/x86_64-linux-gnu/libc.so.6(+0x3f590) [0x7fdb05455590]
    #5 __pthread_kill_implementation at ./nptl/pthread_kill.c:44 (discriminator 1)
    #6 raise at ./signal/../sysdeps/posix/raise.c:27
    #7 abort at ./stdlib/abort.c:81
    #8 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xa1a3d) [0x7fdb050a1a3d]
    #9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7fdb050b306a]
    #10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
    #11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7fdaf0eed562]
    #12 QMessageLogger::fatal() const at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:901
    #13 qt_assert_x(char const*, char const*, char const*, int) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:0
    #14 QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:959
    #15 QWidget::QWidget(QWidgetPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:878
    #16 QDialog::QDialog(QDialogPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qdialog.cpp:377
    #17 QMessageBox::QMessageBox(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/dialogs/qmessagebox.cpp:838
    #18 QtInstance::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtInstance.cxx:825
    #19 Application::CreateMessageDialog(weld::Widget*, VclMessageType, VclButtonsType, rtl::OUString const&, vcl::ILibreOfficeKitNotifier const*) at /home/michi/development/git/libreoffice/vcl/source/window/builder.cxx:224
    #20 dp_gui::DialogHelper::installExtensionWarn(std::basic_string_view<char16_t, std::char_traits<char16_t>>) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_dialog2.cxx:371
    #21 dp_gui::(anonymous namespace)::ProgressCmdEnv::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:477
    #22 dp_misc::interactContinuation(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, bool*, bool*) at /home/michi/development/git/libreoffice/desktop/source/deployment/misc/dp_interact.cxx:114
    #23 dp_manager::ExtensionManager::checkInstall(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:1315
    #24 dp_manager::ExtensionManager::doChecksForAddExtension(com::sun::star::uno::Reference<com::sun::star::deployment::XPackageManager> const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage>&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:565
    #25 dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:655
    #26 non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:0
    #27 dp_gui::ExtensionCmdQueue::Thread::_addExtension(rtl::Reference<dp_gui::(anonymous namespace)::ProgressCmdEnv> const&, rtl::OUString const&, rtl::OUString const&, bool) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:864
    #28 dp_gui::ExtensionCmdQueue::Thread::execute() at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:738
    #29 salhelper::Thread::run() at /home/michi/development/git/libreoffice/salhelper/source/thread.cxx:39
    #30 threadFunc at /home/michi/development/git/libreoffice/include/osl/thread.hxx:190
    #31 osl_thread_start_Impl(void*) at /home/michi/development/git/libreoffice/sal/osl/unx/thread.cxx:245
    #32 start_thread at ./nptl/pthread_create.c:447
    #33 clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80

Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172642
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 5e4c163)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172652
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
tdf-gerrit pushed a commit that referenced this pull request Aug 31, 2024
Besides the obvious cases handled in previous commit

    Change-Id: Ifa84a038fc56f34958cd732caeb9c436b48b3c75
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Fri Aug 30 10:12:21 2024 +0200

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

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

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

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

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

Change-Id: Idb5b20bde8c306ed14efd5467887d55fdf470202
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172643
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172653
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
tdf-gerrit pushed a commit that referenced this pull request Aug 31, 2024
This fixes the following assert seen with the qt6 VCL plugin
when run with a current Qt 6 dev debug build for the tdf#162696
scenario when when native Qt widgets (currently only message dialogs
are implmeneted) are explicitly disabled using
`SAL_VCL_QT_NO_WELDED_WIDGETS=1`.

    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 958
    terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

    Fatal exception: Signal 6
    Stack:
    #0 sal::backtrace_get(unsigned int) at /home/michi/development/git/libreoffice/sal/osl/unx/backtraceapi.cxx:42
    #1 (anonymous namespace)::printStack(int) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:289
    #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:330
    #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:427
    #4 /lib/x86_64-linux-gnu/libc.so.6(+0x3f590) [0x7f73cbe55590]
    #5 __pthread_kill_implementation at ./nptl/pthread_kill.c:44 (discriminator 1)
    #6 raise at ./signal/../sysdeps/posix/raise.c:27
    #7 abort at ./stdlib/abort.c:81
    #8 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xa1a3d) [0x7f73cbaa1a3d]
    #9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7f73cbab306a]
    #10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
    #11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7f73b78ed562]
    #12 QMessageLogger::fatal() const at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:901
    #13 qt_assert_x(char const*, char const*, char const*, int) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:0
    #14 QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:959
    #15 QWidget::QWidget(QWidgetPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:878
    #16 QMenuBar::QMenuBar(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmenubar.cpp:715
    #17 QMainWindow::menuBar() const at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmainwindow.cpp:468
    #18 QtFrame::menuBarOffset() const at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:462
    #19 QtFrame::SetDefaultPos() at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:479
    #20 QtFrame::SetPosSize(long, long, long, long, unsigned short) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:565
    #21 vcl::Window::setPosSizePixel(long, long, long, long, PosSizeFlags) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:2786
    #22 vcl::Window::SetSizePixel(Size const&) at /home/michi/development/git/libreoffice/vcl/source/window/window2.cxx:1344
    #23 SystemWindow::setOptimalLayoutSize(bool) at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1085
    #24 SystemWindow::DoInitialLayout() at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1098
    #25 Dialog::StateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:761
    #26 MessageDialog::StateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/layout.cxx:2706
    #27 vcl::Window::CompatStateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:3921
    #28 vcl::Window::ImplCallInitShow() at /home/michi/development/git/libreoffice/vcl/source/window/event.cxx:496
    #29 vcl::Window::Show(bool, ShowFlags) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:2312
    #30 Dialog::ImplStartExecute() at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:1021
    #31 Dialog::Execute() at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:1071
    #32 SalInstanceDialog::run() at /home/michi/development/git/libreoffice/vcl/source/app/salvtables.cxx:1898
    #33 dp_gui::(anonymous namespace)::ProgressCmdEnv::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:459
    #34 dp_misc::interactContinuation(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, bool*, bool*) at /home/michi/development/git/libreoffice/desktop/source/deployment/misc/dp_interact.cxx:114
    #35 dp_manager::ExtensionManager::checkUpdate(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:1348
    [...]

Change-Id: I9eb0ac63c50de3c713328d0466cb01ea90251741
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172685
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
tdf-gerrit pushed a commit that referenced this pull request Sep 1, 2024
 #0  ImpEditView::GetOutputArea (this=<optimized out>)
     at editeng/source/editeng/impedit.hxx:366
 #1  EditView::GetOutputArea (this=this@entry=0x0)
     at editeng/source/editeng/editview.cxx:442
 #2  0x00007fc50355663a in ScModelObj::setTextSelection(int, int, int) ()
     at sc/source/ui/unoobj/docuno.cxx:870
 #3  0x00007fc51206e910 in doc_setTextSelection ()
     at desktop/source/lib/init.cxx:5653
 #4  0x0000000000577c54 in lok::Document::setTextSelection (nY=<optimized out>, nX=<optimized out>, nType=<optimized out>,
     this=<optimized out>)

Change-Id: If30a32b6c365fb7fdcfcfcaa27e08ed39c75116f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172678
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 2, 2024
 #0  ImpEditView::GetOutputArea (this=<optimized out>)
     at editeng/source/editeng/impedit.hxx:366
 #1  EditView::GetOutputArea (this=this@entry=0x0)
     at editeng/source/editeng/editview.cxx:442
 #2  0x00007fc50355663a in ScModelObj::setTextSelection(int, int, int) ()
     at sc/source/ui/unoobj/docuno.cxx:870
 #3  0x00007fc51206e910 in doc_setTextSelection ()
     at desktop/source/lib/init.cxx:5653
 #4  0x0000000000577c54 in lok::Document::setTextSelection (nY=<optimized out>, nX=<optimized out>, nType=<optimized out>,
     this=<optimized out>)

Change-Id: If30a32b6c365fb7fdcfcfcaa27e08ed39c75116f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172711
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 2, 2024
 #0  ImpEditView::GetOutputArea (this=<optimized out>)
     at editeng/source/editeng/impedit.hxx:366
 #1  EditView::GetOutputArea (this=this@entry=0x0)
     at editeng/source/editeng/editview.cxx:442
 #2  0x00007fc50355663a in ScModelObj::setTextSelection(int, int, int) ()
     at sc/source/ui/unoobj/docuno.cxx:870
 #3  0x00007fc51206e910 in doc_setTextSelection ()
     at desktop/source/lib/init.cxx:5653
 #4  0x0000000000577c54 in lok::Document::setTextSelection (nY=<optimized out>, nX=<optimized out>, nType=<optimized out>,
     this=<optimized out>)

Change-Id: If30a32b6c365fb7fdcfcfcaa27e08ed39c75116f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172678
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit fc7e5f5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172679
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request Sep 5, 2024
This fixes the following assert seen with the qt6 VCL plugin
when run with a current Qt 6 dev debug build for the tdf#162696
scenario when when native Qt widgets (currently only message dialogs
are implmeneted) are explicitly disabled using
`SAL_VCL_QT_NO_WELDED_WIDGETS=1`.

    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 958
    terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

    Fatal exception: Signal 6
    Stack:
    #0 sal::backtrace_get(unsigned int) at /home/michi/development/git/libreoffice/sal/osl/unx/backtraceapi.cxx:42
    #1 (anonymous namespace)::printStack(int) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:289
    #2 (anonymous namespace)::callSystemHandler(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:330
    #3 (anonymous namespace)::signalHandlerFunction(int, siginfo_t*, void*) at /home/michi/development/git/libreoffice/sal/osl/unx/signal.cxx:427
    #4 /lib/x86_64-linux-gnu/libc.so.6(+0x3f590) [0x7f73cbe55590]
    #5 __pthread_kill_implementation at ./nptl/pthread_kill.c:44 (discriminator 1)
    #6 raise at ./signal/../sysdeps/posix/raise.c:27
    #7 abort at ./stdlib/abort.c:81
    #8 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xa1a3d) [0x7f73cbaa1a3d]
    #9 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xb306a) [0x7f73cbab306a]
    #10 std::unexpected() in /lib/x86_64-linux-gnu/libstdc++.so.6
    #11 /home/michi/development/git/qt5/qtbase/lib/libQt6Core.so.6(+0xed562) [0x7f73b78ed562]
    #12 QMessageLogger::fatal() const at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:901
    #13 qt_assert_x(char const*, char const*, char const*, int) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:0
    #14 QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:959
    #15 QWidget::QWidget(QWidgetPrivate&, QWidget*, QFlags<Qt::WindowType>) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:878
    #16 QMenuBar::QMenuBar(QWidget*) at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmenubar.cpp:715
    #17 QMainWindow::menuBar() const at /home/michi/development/git/qt5/qtbase/src/widgets/widgets/qmainwindow.cpp:468
    #18 QtFrame::menuBarOffset() const at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:462
    #19 QtFrame::SetDefaultPos() at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:479
    #20 QtFrame::SetPosSize(long, long, long, long, unsigned short) at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:565
    #21 vcl::Window::setPosSizePixel(long, long, long, long, PosSizeFlags) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:2786
    #22 vcl::Window::SetSizePixel(Size const&) at /home/michi/development/git/libreoffice/vcl/source/window/window2.cxx:1344
    #23 SystemWindow::setOptimalLayoutSize(bool) at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1085
    #24 SystemWindow::DoInitialLayout() at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1098
    #25 Dialog::StateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:761
    #26 MessageDialog::StateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/layout.cxx:2706
    #27 vcl::Window::CompatStateChanged(StateChangedType) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:3921
    #28 vcl::Window::ImplCallInitShow() at /home/michi/development/git/libreoffice/vcl/source/window/event.cxx:496
    #29 vcl::Window::Show(bool, ShowFlags) at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:2312
    #30 Dialog::ImplStartExecute() at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:1021
    #31 Dialog::Execute() at /home/michi/development/git/libreoffice/vcl/source/window/dialog.cxx:1071
    #32 SalInstanceDialog::run() at /home/michi/development/git/libreoffice/vcl/source/app/salvtables.cxx:1898
    #33 dp_gui::(anonymous namespace)::ProgressCmdEnv::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx:459
    #34 dp_misc::interactContinuation(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, bool*, bool*) at /home/michi/development/git/libreoffice/desktop/source/deployment/misc/dp_interact.cxx:114
    #35 dp_manager::ExtensionManager::checkUpdate(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) at /home/michi/development/git/libreoffice/desktop/source/deployment/manager/dp_extensionmanager.cxx:1348
    [...]

Change-Id: I9eb0ac63c50de3c713328d0466cb01ea90251741
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172685
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 5ef991f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172674
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 7, 2024
The stack trace was:

Thread 1 "soffice.bin" received signal SIGSEGV, Segmentation fault.
0x00007ffff32175ee in rtl::OUString::OUString (this=0x7fffffffaac0, str=...) at /home/cono/git/lo/libreoffice/include/rtl/ustring.hxx:197
197	        pData = str.pData;
#0  0x00007ffff32175ee in rtl::OUString::OUString(rtl::OUString const&) (this=0x7fffffffaac0, str=...) at /home/cono/git/lo/libreoffice/include/rtl/ustring.hxx:197
#1  0x00007ffff3521e4f in GalleryBrowser1::GetItemText(SgaObject const&, GalleryItemFlags) (rObj=..., nItemTextFlags=GalleryItemFlags::Title) at /home/cono/git/lo/libreoffice/svx/source/gallery2/galbrws1.cxx:1412
#2  0x00007ffff352265d in GalleryBrowser1::FillThemeEntries() (this=0x55555c0c9240) at /home/cono/git/lo/libreoffice/svx/source/gallery2/galbrws1.cxx:1505
#3  0x00007ffff351a602 in GalleryBrowser1::GalleryBrowser1(weld::Builder&, Gallery*) (this=0x55555c0c9240, rBuilder=..., pGallery=0x55555c0a4aa0) at /home/cono/git/lo/libreoffice/svx/source/gallery2/galbrws1.cxx:196
#4  0x00007ffff354c291 in svx::sidebar::GalleryControl::GalleryControl(weld::Widget*) (this=0x55555c04e470, pParent=0x55555be85558) at /home/cono/git/lo/libreoffice/svx/source/gallery2/GalleryControl.cxx:32
#5  0x00007ffff45c72ea in std::make_unique<svx::sidebar::GalleryControl, weld::Widget*&>(weld::Widget*&) () at /usr/include/c++/12/bits/unique_ptr.h:1065
#6  0x00007ffff45c5f7a in (anonymous namespace)::PanelFactory::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x55555c0494e0, rsResourceURL=..., rArguments=...) at /home/cono/git/lo/libreoffice/svx/source/sidebar/PanelFactory.cxx:180
#7  0x00007ffff6412417 in (anonymous namespace)::UIElementFactoryManager::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x5555564db3e0, ResourceURL=..., Args=...) at /home/cono/git/lo/libreoffice/framework/source/uifactory/uielementfactorymanager.cxx:440
#8  0x00007ffff5593a35 in sfx2::sidebar::SidebarController::CreateUIElement(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, rtl::OUString const&, bool, sfx2::sidebar::Context const&) (this=0x55555b0a8100, rxWindow=..., rsImplementationURL=..., bWantsCanvas=false, rContext=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:1044
#9  0x00007ffff5593341 in sfx2::sidebar::SidebarController::CreatePanel(std::basic_string_view<char16_t, std::char_traits<char16_t> >, weld::Widget*, bool, sfx2::sidebar::Context const&, VclPtr<sfx2::sidebar::Deck> const&) (this=0x55555b0a8100, rsPanelId=u"GalleryPanel", pParentWindow=0x55555c040718, bIsInitiallyExpanded=true, rContext=..., pDeck=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:989
#10 0x00007ffff5592150 in sfx2::sidebar::SidebarController::CreatePanels(std::basic_string_view<char16_t, std::char_traits<char16_t> >, sfx2::sidebar::Context const&) (this=0x55555b0a8100, rDeckId=u"GalleryDeck", rContext=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:789
#11 0x00007ffff5591dbe in sfx2::sidebar::SidebarController::CreateDeck(std::basic_string_view<char16_t, std::char_traits<char16_t> >, sfx2::sidebar::Context const&, bool) (this=0x55555b0a8100, rDeckId=u"GalleryDeck", rContext=..., bForceCreate=false) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:737
#12 0x00007ffff5592b96 in sfx2::sidebar::SidebarController::SwitchToDeck(sfx2::sidebar::DeckDescriptor const&, sfx2::sidebar::Context const&) (this=0x55555b0a8100, rDeckDescriptor=..., rContext=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:899
#13 0x00007ffff5591b89 in sfx2::sidebar::SidebarController::SwitchToDeck(std::basic_string_view<char16_t, std::char_traits<char16_t> >) (this=0x55555b0a8100, rsDeckId=u"GalleryDeck") at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:708
#14 0x00007ffff5591936 in sfx2::sidebar::SidebarController::OpenThenToggleDeck(rtl::OUString const&) (this=0x55555b0a8100, rsDeckId=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:664
#15 0x00007ffff558d884 in operator()(rtl::OUString const&) const (__closure=0x7fffffffb7c0, rsDeckId=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:123
#16 0x00007ffff5598e13 in std::__invoke_impl<void, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, const SfxViewFrame*)::<lambda(const rtl::OUString&)>&, const rtl::OUString&>(std::__invoke_other, struct {...} &) (__f=...) at /usr/include/c++/12/bits/invoke.h:61
#17 0x00007ffff559851c in std::__invoke_r<void, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, const SfxViewFrame*)::<lambda(const rtl::OUString&)>&, const rtl::OUString&>(struct {...} &) (__fn=...) at /usr/include/c++/12/bits/invoke.h:111
#18 0x00007ffff5597b76 in std::_Function_handler<void(const rtl::OUString&), sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, const SfxViewFrame*)::<lambda(const rtl::OUString&)> >::_M_invoke(const std::_Any_data &, const rtl::OUString &) (__functor=..., __args#0=...) at /usr/include/c++/12/bits/std_function.h:290
#19 0x00007ffff55e2bed in std::function<void (rtl::OUString const&)>::operator()(rtl::OUString const&) const (this=0x7fffffffb7c0, __args#0=...) at /usr/include/c++/12/bits/std_function.h:591
#20 0x00007ffff55e09aa in sfx2::sidebar::TabBar::Item::HandleClick(rtl::OUString const&) (this=0x55555b133290) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/TabBar.cxx:274
#21 0x00007ffff55e0933 in sfx2::sidebar::TabBar::Item::LinkStubHandleClick(void*, rtl::OUString const&) (instance=0x55555b133290, data=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/TabBar.cxx:264
#22 0x00007fffe688a6b7 in Link<rtl::OUString const&, void>::Call(rtl::OUString const&) const (this=0x555556f7ee38, data=...) at /home/cono/git/lo/libreoffice/include/tools/link.hxx:111
#23 0x00007fffe68821c9 in weld::Toolbar::signal_clicked(rtl::OUString const&) (this=0x555556f7ee30, rIdent=...) at /home/cono/git/lo/libreoffice/include/vcl/weld.hxx:2512
#24 0x00007fffe683260b in (anonymous namespace)::GtkInstanceToolbar::signal_item_clicked(GtkToolButton*) (this=0x555556f7ebe0, pItem=0x55555b13a9a0) at /home/cono/git/lo/libreoffice/vcl/unx/gtk3/gtkinst.cxx:12009
#25 0x00007fffe6832553 in (anonymous namespace)::GtkInstanceToolbar::signalItemClicked(GtkToolButton*, gpointer) (pItem=0x55555b13a9a0, widget=0x555556f7ebe0) at /home/cono/git/lo/libreoffice/vcl/unx/gtk3/gtkinst.cxx:12000
...

I suspect that there is a corner case of some element giving a nullptr
in xSgaObject; but since I can't repro locally, it's just a guess. Other
places using AcquireObject in the file do check its return, so it seems
reasonable to do the same here.

Change-Id: I40c0d64a7219d483ec94f56c56a6df0ce79e9c51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172280
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173027
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 8, 2024
The stack trace was:

Thread 1 "soffice.bin" received signal SIGSEGV, Segmentation fault.
0x00007ffff32175ee in rtl::OUString::OUString (this=0x7fffffffaac0, str=...) at /home/cono/git/lo/libreoffice/include/rtl/ustring.hxx:197
197	        pData = str.pData;
#0  0x00007ffff32175ee in rtl::OUString::OUString(rtl::OUString const&) (this=0x7fffffffaac0, str=...) at /home/cono/git/lo/libreoffice/include/rtl/ustring.hxx:197
#1  0x00007ffff3521e4f in GalleryBrowser1::GetItemText(SgaObject const&, GalleryItemFlags) (rObj=..., nItemTextFlags=GalleryItemFlags::Title) at /home/cono/git/lo/libreoffice/svx/source/gallery2/galbrws1.cxx:1412
#2  0x00007ffff352265d in GalleryBrowser1::FillThemeEntries() (this=0x55555c0c9240) at /home/cono/git/lo/libreoffice/svx/source/gallery2/galbrws1.cxx:1505
#3  0x00007ffff351a602 in GalleryBrowser1::GalleryBrowser1(weld::Builder&, Gallery*) (this=0x55555c0c9240, rBuilder=..., pGallery=0x55555c0a4aa0) at /home/cono/git/lo/libreoffice/svx/source/gallery2/galbrws1.cxx:196
#4  0x00007ffff354c291 in svx::sidebar::GalleryControl::GalleryControl(weld::Widget*) (this=0x55555c04e470, pParent=0x55555be85558) at /home/cono/git/lo/libreoffice/svx/source/gallery2/GalleryControl.cxx:32
#5  0x00007ffff45c72ea in std::make_unique<svx::sidebar::GalleryControl, weld::Widget*&>(weld::Widget*&) () at /usr/include/c++/12/bits/unique_ptr.h:1065
#6  0x00007ffff45c5f7a in (anonymous namespace)::PanelFactory::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x55555c0494e0, rsResourceURL=..., rArguments=...) at /home/cono/git/lo/libreoffice/svx/source/sidebar/PanelFactory.cxx:180
#7  0x00007ffff6412417 in (anonymous namespace)::UIElementFactoryManager::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x5555564db3e0, ResourceURL=..., Args=...) at /home/cono/git/lo/libreoffice/framework/source/uifactory/uielementfactorymanager.cxx:440
#8  0x00007ffff5593a35 in sfx2::sidebar::SidebarController::CreateUIElement(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, rtl::OUString const&, bool, sfx2::sidebar::Context const&) (this=0x55555b0a8100, rxWindow=..., rsImplementationURL=..., bWantsCanvas=false, rContext=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:1044
#9  0x00007ffff5593341 in sfx2::sidebar::SidebarController::CreatePanel(std::basic_string_view<char16_t, std::char_traits<char16_t> >, weld::Widget*, bool, sfx2::sidebar::Context const&, VclPtr<sfx2::sidebar::Deck> const&) (this=0x55555b0a8100, rsPanelId=u"GalleryPanel", pParentWindow=0x55555c040718, bIsInitiallyExpanded=true, rContext=..., pDeck=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:989
#10 0x00007ffff5592150 in sfx2::sidebar::SidebarController::CreatePanels(std::basic_string_view<char16_t, std::char_traits<char16_t> >, sfx2::sidebar::Context const&) (this=0x55555b0a8100, rDeckId=u"GalleryDeck", rContext=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:789
#11 0x00007ffff5591dbe in sfx2::sidebar::SidebarController::CreateDeck(std::basic_string_view<char16_t, std::char_traits<char16_t> >, sfx2::sidebar::Context const&, bool) (this=0x55555b0a8100, rDeckId=u"GalleryDeck", rContext=..., bForceCreate=false) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:737
#12 0x00007ffff5592b96 in sfx2::sidebar::SidebarController::SwitchToDeck(sfx2::sidebar::DeckDescriptor const&, sfx2::sidebar::Context const&) (this=0x55555b0a8100, rDeckDescriptor=..., rContext=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:899
#13 0x00007ffff5591b89 in sfx2::sidebar::SidebarController::SwitchToDeck(std::basic_string_view<char16_t, std::char_traits<char16_t> >) (this=0x55555b0a8100, rsDeckId=u"GalleryDeck") at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:708
#14 0x00007ffff5591936 in sfx2::sidebar::SidebarController::OpenThenToggleDeck(rtl::OUString const&) (this=0x55555b0a8100, rsDeckId=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:664
#15 0x00007ffff558d884 in operator()(rtl::OUString const&) const (__closure=0x7fffffffb7c0, rsDeckId=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/SidebarController.cxx:123
#16 0x00007ffff5598e13 in std::__invoke_impl<void, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, const SfxViewFrame*)::<lambda(const rtl::OUString&)>&, const rtl::OUString&>(std::__invoke_other, struct {...} &) (__f=...) at /usr/include/c++/12/bits/invoke.h:61
#17 0x00007ffff559851c in std::__invoke_r<void, sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, const SfxViewFrame*)::<lambda(const rtl::OUString&)>&, const rtl::OUString&>(struct {...} &) (__fn=...) at /usr/include/c++/12/bits/invoke.h:111
#18 0x00007ffff5597b76 in std::_Function_handler<void(const rtl::OUString&), sfx2::sidebar::SidebarController::SidebarController(sfx2::sidebar::SidebarDockingWindow*, const SfxViewFrame*)::<lambda(const rtl::OUString&)> >::_M_invoke(const std::_Any_data &, const rtl::OUString &) (__functor=..., __args#0=...) at /usr/include/c++/12/bits/std_function.h:290
#19 0x00007ffff55e2bed in std::function<void (rtl::OUString const&)>::operator()(rtl::OUString const&) const (this=0x7fffffffb7c0, __args#0=...) at /usr/include/c++/12/bits/std_function.h:591
#20 0x00007ffff55e09aa in sfx2::sidebar::TabBar::Item::HandleClick(rtl::OUString const&) (this=0x55555b133290) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/TabBar.cxx:274
#21 0x00007ffff55e0933 in sfx2::sidebar::TabBar::Item::LinkStubHandleClick(void*, rtl::OUString const&) (instance=0x55555b133290, data=...) at /home/cono/git/lo/libreoffice/sfx2/source/sidebar/TabBar.cxx:264
#22 0x00007fffe688a6b7 in Link<rtl::OUString const&, void>::Call(rtl::OUString const&) const (this=0x555556f7ee38, data=...) at /home/cono/git/lo/libreoffice/include/tools/link.hxx:111
#23 0x00007fffe68821c9 in weld::Toolbar::signal_clicked(rtl::OUString const&) (this=0x555556f7ee30, rIdent=...) at /home/cono/git/lo/libreoffice/include/vcl/weld.hxx:2512
#24 0x00007fffe683260b in (anonymous namespace)::GtkInstanceToolbar::signal_item_clicked(GtkToolButton*) (this=0x555556f7ebe0, pItem=0x55555b13a9a0) at /home/cono/git/lo/libreoffice/vcl/unx/gtk3/gtkinst.cxx:12009
#25 0x00007fffe6832553 in (anonymous namespace)::GtkInstanceToolbar::signalItemClicked(GtkToolButton*, gpointer) (pItem=0x55555b13a9a0, widget=0x555556f7ebe0) at /home/cono/git/lo/libreoffice/vcl/unx/gtk3/gtkinst.cxx:12000
...

I suspect that there is a corner case of some element giving a nullptr
in xSgaObject; but since I can't repro locally, it's just a guess. Other
places using AcquireObject in the file do check its return, so it seems
reasonable to do the same here.

Change-Id: I40c0d64a7219d483ec94f56c56a6df0ce79e9c51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172280
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173027
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173031
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 10, 2024
At least with one ASan/UBSan setup of mine using LODE's Clang 12.0.1,
./autogen.sh would occasionally detect -std=gnu11 as the required CC "option to
enable C11 features" (which would in turn cause building external/firebird to
fail oddly; an issue worth investigations of its own), because Clang would
occasionally crash with a SEGV on the corresponding configure test program's
first invocation (without -std=gnu11) when invoked with -O2 (and happen to
succeed on second invocation with -std=gnu11, so configure thinks that's
needed), see below for a relevant config.log excerpt.

When CC/CXX are already set (as is the case in this scenario), we could arguably
skip the AC_PROG_CC/CXX checks entirely (and thus avoid configure potentially
adding -std=gnu11 to CC), but at least AC_PROG_CC also internally sets the GCC
shell var, which we use in configure.ac.  So better be conservative and just
avoid -O2 during AC_PROG_CC/CXX (whatever the autoconf motivation to include it
in the first place).

> configure:8165: checking for /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist option to enable C11 features
> configure:8180: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist  -c -g -O2  conftest.c >&5
> PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
> Stack dump:
> 0.	Program arguments: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist -c -g -O2 conftest.c
> 1.	<eof> parser at end of file
> 2.	Code generation
>  #0 0x000055f3a890caf2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1c3eaf2)
>  #1 0x000055f3a890a734 llvm::sys::RunSignalHandlers() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1c3c734)
>  #2 0x000055f3a887b998 CrashRecoverySignalHandler(int) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1bad998)
>  #3 0x00007f750d24e520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
>  #4 0x000055f3a93f9cd4 llvm::DIE::getUnitDie() const (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x272bcd4)
>  #5 0x000055f3a9404574 llvm::DwarfDebug::finishEntityDefinitions() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2736574)
>  #6 0x000055f3a941df99 llvm::DwarfDebug::finalizeModuleInfo() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x274ff99)
>  #7 0x000055f3a9421128 llvm::DwarfDebug::endModule() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2753128)
>  #8 0x000055f3a93f1219 llvm::AsmPrinter::doFinalization(llvm::Module&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2723219)
>  #9 0x000055f3a82478f5 llvm::FPPassManager::doFinalization(llvm::Module&) (.localalias) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x15798f5)
> #10 0x000055f3a8253900 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1585900)
> #11 0x000055f3a8bb57d3 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (.constprop.0) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1ee77d3)
> #12 0x000055f3a8bb76ea clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1ee96ea)
> #13 0x000055f3a9825876 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2b57876)
> #14 0x000055f3aa35c549 clang::ParseAST(clang::Sema&, bool, bool) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x368e549)
> #15 0x000055f3a91ef2d9 clang::FrontendAction::Execute() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x25212d9)
> #16 0x000055f3a91903a3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x24c23a3)
> #17 0x000055f3a92a2fd8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x25d4fd8)
> #18 0x000055f3a7798815 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xaca815)
> #19 0x000055f3a77961a7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xac81a7)
> #20 0x000055f3a9039689 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x236b689)
> #21 0x000055f3a887baa7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1badaa7)
> #22 0x000055f3a903a802 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.0) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x236c802)
> #23 0x000055f3a900fbec clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2341bec)
> #24 0x000055f3a9010679 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2342679)
> #25 0x000055f3a901e8f1 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x23508f1)
> #26 0x000055f3a7717e6f main (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xa49e6f)
> #27 0x00007f750d235d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
> #28 0x00007f750d235e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
> #29 0x000055f3a7795b55 _start (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xac7b55)
> clang-12: error: clang frontend command failed with exit code 139 (use -v to see invocation)
> clang version 12.0.1 (https://github.com/llvm/llvm-project.git fed41342a82f5a3a9201819a82bf7a48313e296b)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin
> clang-12: note: diagnostic msg:
> ********************
>
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang-12: note: diagnostic msg: /tmp/conftest-968380.c
> clang-12: note: diagnostic msg: /tmp/conftest-968380.sh
> clang-12: note: diagnostic msg:
>
> ********************
> configure:8180: $? = 139
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "LibreOffice"
> | #define PACKAGE_TARNAME "libreoffice"
> | #define PACKAGE_VERSION "24.8.0.0.alpha0+"
> | #define PACKAGE_STRING "LibreOffice 24.8.0.0.alpha0+"
> | #define PACKAGE_BUGREPORT ""
> | #define PACKAGE_URL "http://documentfoundation.org/"
> | #define LIBO_VERSION_MAJOR 24
> | #define LIBO_VERSION_MINOR 8
> | #define LIBO_VERSION_MICRO 0
> | #define LIBO_VERSION_PATCH 0
> | #define LIBO_THIS_YEAR 2024
> | #define SRCDIR "/home/sberg/lo0/core"
> | #define SRC_ROOT "/home/sberg/lo0/core"
> | #define BUILDDIR "/home/sberg/lo0/core"
> | #define USE_HEADLESS_CODE 1
> | #define ENABLE_HEADLESS 1
> | /* end confdefs.h.  */
> |
> | /* Does the compiler advertise C89 conformance?
> |    Do not test the value of __STDC__, because some compilers set it to 0
> |    while being otherwise adequately conformant. */
> | #if !defined __STDC__
> | # error "Compiler does not advertise C89 conformance"
> | #endif
> |
> | #include <stddef.h>
> | #include <stdarg.h>
> | struct stat;
> | /* Most of the following tests are stolen from RCS 5.7 src/conf.sh.  */
> | struct buf { int x; };
> | struct buf * (*rcsopen) (struct buf *, struct stat *, int);
> | static char *e (p, i)
> |      char **p;
> |      int i;
> | {
> |   return p[i];
> | }
> | static char *f (char * (*g) (char **, int), char **p, ...)
> | {
> |   char *s;
> |   va_list v;
> |   va_start (v,p);
> |   s = g (p, va_arg (v,int));
> |   va_end (v);
> |   return s;
> | }
> |
> | /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
> |    function prototypes and stuff, but not \xHH hex character constants.
> |    These do not provoke an error unfortunately, instead are silently treated
> |    as an "x".  The following induces an error, until -std is added to get
> |    proper ANSI mode.  Curiously \x00 != x always comes out true, for an
> |    array size at least.  It is necessary to write \x00 == 0 to get something
> |    that is true only with -std.  */
> | int osf4_cc_array ['\x00' == 0 ? 1 : -1];
> |
> | /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
> |    inside strings and character constants.  */
> | #define FOO(x) 'x'
> | int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
> |
> | int test (int i, double x);
> | struct s1 {int (*f) (int a);};
> | struct s2 {int (*f) (double a);};
> | int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
> |                int, int);
> |
> | // Does the compiler advertise C99 conformance?
> | #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
> | # error "Compiler does not advertise C99 conformance"
> | #endif
> |
> | #include <stdbool.h>
> | extern int puts (const char *);
> | extern int printf (const char *, ...);
> | extern int dprintf (int, const char *, ...);
> | extern void *malloc (size_t);
> |
> | // Check varargs macros.  These examples are taken from C99 6.10.3.5.
> | // dprintf is used instead of fprintf to avoid needing to declare
> | // FILE and stderr.
> | #define debug(...) dprintf (2, __VA_ARGS__)
> | #define showlist(...) puts (#__VA_ARGS__)
> | #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
> | static void
> | test_varargs_macros (void)
> | {
> |   int x = 1234;
> |   int y = 5678;
> |   debug ("Flag");
> |   debug ("X = %d\n", x);
> |   showlist (The first, second, and third items.);
> |   report (x>y, "x is %d but y is %d", x, y);
> | }
> |
> | // Check long long types.
> | #define BIG64 18446744073709551615ull
> | #define BIG32 4294967295ul
> | #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
> | #if !BIG_OK
> |   #error "your preprocessor is broken"
> | #endif
> | #if BIG_OK
> | #else
> |   #error "your preprocessor is broken"
> | #endif
> | static long long int bignum = -9223372036854775807LL;
> | static unsigned long long int ubignum = BIG64;
> |
> | struct incomplete_array
> | {
> |   int datasize;
> |   double data[];
> | };
> |
> | struct named_init {
> |   int number;
> |   const wchar_t *name;
> |   double average;
> | };
> |
> | typedef const char *ccp;
> |
> | static inline int
> | test_restrict (ccp restrict text)
> | {
> |   // See if C++-style comments work.
> |   // Iterate through items via the restricted pointer.
> |   // Also check for declarations in for loops.
> |   for (unsigned int i = 0; *(text+i) != '\0'; ++i)
> |     continue;
> |   return 0;
> | }
> |
> | // Check varargs and va_copy.
> | static bool
> | test_varargs (const char *format, ...)
> | {
> |   va_list args;
> |   va_start (args, format);
> |   va_list args_copy;
> |   va_copy (args_copy, args);
> |
> |   const char *str = "";
> |   int number = 0;
> |   float fnumber = 0;
> |
> |   while (*format)
> |     {
> |       switch (*format++)
> | 	{
> | 	case 's': // string
> | 	  str = va_arg (args_copy, const char *);
> | 	  break;
> | 	case 'd': // int
> | 	  number = va_arg (args_copy, int);
> | 	  break;
> | 	case 'f': // float
> | 	  fnumber = va_arg (args_copy, double);
> | 	  break;
> | 	default:
> | 	  break;
> | 	}
> |     }
> |   va_end (args_copy);
> |   va_end (args);
> |
> |   return *str && number && fnumber;
> | }
> |
> |
> | // Does the compiler advertise C11 conformance?
> | #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
> | # error "Compiler does not advertise C11 conformance"
> | #endif
> |
> | // Check _Alignas.
> | char _Alignas (double) aligned_as_double;
> | char _Alignas (0) no_special_alignment;
> | extern char aligned_as_int;
> | char _Alignas (0) _Alignas (int) aligned_as_int;
> |
> | // Check _Alignof.
> | enum
> | {
> |   int_alignment = _Alignof (int),
> |   int_array_alignment = _Alignof (int[100]),
> |   char_alignment = _Alignof (char)
> | };
> | _Static_assert (0 < -_Alignof (int), "_Alignof is signed");
> |
> | // Check _Noreturn.
> | int _Noreturn does_not_return (void) { for (;;) continue; }
> |
> | // Check _Static_assert.
> | struct test_static_assert
> | {
> |   int x;
> |   _Static_assert (sizeof (int) <= sizeof (long int),
> |                   "_Static_assert does not work in struct");
> |   long int y;
> | };
> |
> | // Check UTF-8 literals.
> | #define u8 syntax error!
> | char const utf8_literal[] = u8"happens to be ASCII" "another string";
> |
> | // Check duplicate typedefs.
> | typedef long *long_ptr;
> | typedef long int *long_ptr;
> | typedef long_ptr long_ptr;
> |
> | // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
> | struct anonymous
> | {
> |   union {
> |     struct { int i; int j; };
> |     struct { int k; long int l; } w;
> |   };
> |   int m;
> | } v1;
> |
> |
> | int
> | main (int argc, char **argv)
> | {
> |   int ok = 0;
> |
> | ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
> |
> |
> |   // Check bool.
> |   _Bool success = false;
> |   success |= (argc != 0);
> |
> |   // Check restrict.
> |   if (test_restrict ("String literal") == 0)
> |     success = true;
> |   char *restrict newvar = "Another string";
> |
> |   // Check varargs.
> |   success &= test_varargs ("s, d' f .", "string", 65, 34.234);
> |   test_varargs_macros ();
> |
> |   // Check flexible array members.
> |   struct incomplete_array *ia =
> |     malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
> |   ia->datasize = 10;
> |   for (int i = 0; i < ia->datasize; ++i)
> |     ia->data[i] = i * 1.234;
> |
> |   // Check named initializers.
> |   struct named_init ni = {
> |     .number = 34,
> |     .name = L"Test wide string",
> |     .average = 543.34343,
> |   };
> |
> |   ni.number = 58;
> |
> |   int dynamic_array[ni.number];
> |   dynamic_array[0] = argv[0][0];
> |   dynamic_array[ni.number - 1] = 543;
> |
> |   // work around unused variable warnings
> |   ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
> | 	 || dynamic_array[ni.number - 1] != 543);
> |
> |
> |   _Static_assert ((offsetof (struct anonymous, i)
> | 		   == offsetof (struct anonymous, w.k)),
> | 		  "Anonymous union alignment botch");
> |   v1.i = 2;
> |   v1.w.k = 5;
> |   ok |= v1.i != 5;
> |
> |   return ok;
> | }
> |
> configure:8180: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist -std=gnu11 -c -g -O2  conftest.c >&5
> configure:8180: $? = 0
> configure:8201: result: -std=gnu11

Change-Id: I9122d0d853d0010155d57cb1d1d56f7c453d5208
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165904
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
(cherry picked from commit 42f6e89)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173098
Tested-by: allotropia jenkins <jenkins@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Sep 12, 2024
warn and use the default pool pattern if this happens

 #0  WhichRangesContainer::getOffsetFromWhich (this=this@entry=0x38, nWhich=nWhich@entry=129) at libreoffice/svl/source/items/itemset.cxx:1895
 #1  0x00007fe0179fa4ac in SfxItemSet::Get (this=0x10, nWhich=129, bSrchInParent=<optimized out>) at libreoffice/svl/source/items/itemset.cxx:1152
 #2  0x00007fe00736aa2e in ScPatternAttr::GetItem (nWhichP=129, this=0x0) at libreoffice/sc/inc/patattr.hxx:71
 #3  ScPatternAttr::GetItem<SvxHorJustifyItem> (nWhich=..., this=0x0) at libreoffice/sc/inc/patattr.hxx:73
 #4  ScViewData::SetEditEngine (this=this@entry=0x3323c540, eWhich=eWhich@entry=SC_SPLIT_BOTTOMLEFT, pNewEngine=<optimized out>, pWin=pWin@entry=0x32eec4f0, nNewX=nNewX@entry=-1, nNewY=nNewY@entry=-1)
     at libreoffice/sc/source/ui/view/viewdata.cxx:1613
 #5  0x00007fe00731c2f1 in ScTabView::UpdateEditView (this=this@entry=0x3323c538) at libreoffice/sc/source/ui/view/tabview3.cxx:2248
 #6  0x00007fe00731c9ae in ScTabView::UpdateFormulas (this=this@entry=0x3323c538, nStartCol=nStartCol@entry=-1, nStartRow=nStartRow@entry=-1, nEndCol=nEndCol@entry=-1, nEndRow=nEndRow@entry=-1)
     at libreoffice/sc/source/ui/view/tabview3.cxx:2393
 #7  0x00007fe007338bc5 in ScTabViewShell::Notify (this=0x3323c330, rBC=..., rHint=...) at libreoffice/sc/source/ui/view/tabvwsh5.cxx:219
 #8  0x00007fe017a29bb9 in SfxBroadcaster::Broadcast (this=this@entry=0x2fd10a70, rHint=...) at libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
 #9  0x00007fe006f27c3f in ScDocShell::PostDataChanged (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh3.cxx:95
 #10 0x00007fe006f17dfc in ScDocShell::SetDocumentModified (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh.cxx:3050
 #11 0x00007fe007382e7c in ScViewFunc::DeleteTables (this=this@entry=0x3464aa28, TheTabs=std::vector of length 1, capacity 1 = {...}, bRecord=<optimized out>, bRecord@entry=true)
     at libreoffice/sc/source/ui/view/viewfun2.cxx:2656
 #12 0x00007fe007350825 in ScTabViewShell::ExecuteTable (this=0x3464a820, rReq=...) at libreoffice/sc/source/ui/view/tabvwshf.cxx:910
 #13 0x00007fe0175d0cef in SfxDispatcher::Call_Impl (this=0x340a1b70, rShell=..., rSlot=..., rReq=..., bRecord=<optimized out>)
     at libreoffice/sfx2/source/control/dispatch.cxx:254
 #14 0x00007fe0175d8daa in SfxDispatcher::Execute (this=0x340a1b70, nSlot=<optimized out>, nCall=nCall@entry=SfxCallMode::RECORD, pArgs=pArgs@entry=0x7ffe3c51edf0, pInternalArgs=pInternalArgs@entry=0x7ffe3c51ed90, nModi=0)
     at libreoffice/sfx2/source/control/dispatch.cxx:813
 #15 0x00007fe0176166f5 in SfxDispatchController_Impl::dispatch (this=<optimized out>, aURL=..., aArgs=uno::Sequence of length 1 = {...}, rListener=empty uno::Reference)
    at libreoffice/include/sfx2/ctrlitem.hxx:63

Change-Id: Ib4851414a277a293d6bc44b4ffcd33d332e3c57e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173183
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 13, 2024
warn and use the default pool pattern if this happens

 #0  WhichRangesContainer::getOffsetFromWhich (this=this@entry=0x38, nWhich=nWhich@entry=129) at libreoffice/svl/source/items/itemset.cxx:1895
 #1  0x00007fe0179fa4ac in SfxItemSet::Get (this=0x10, nWhich=129, bSrchInParent=<optimized out>) at libreoffice/svl/source/items/itemset.cxx:1152
 #2  0x00007fe00736aa2e in ScPatternAttr::GetItem (nWhichP=129, this=0x0) at libreoffice/sc/inc/patattr.hxx:71
 #3  ScPatternAttr::GetItem<SvxHorJustifyItem> (nWhich=..., this=0x0) at libreoffice/sc/inc/patattr.hxx:73
 #4  ScViewData::SetEditEngine (this=this@entry=0x3323c540, eWhich=eWhich@entry=SC_SPLIT_BOTTOMLEFT, pNewEngine=<optimized out>, pWin=pWin@entry=0x32eec4f0, nNewX=nNewX@entry=-1, nNewY=nNewY@entry=-1)
     at libreoffice/sc/source/ui/view/viewdata.cxx:1613
 #5  0x00007fe00731c2f1 in ScTabView::UpdateEditView (this=this@entry=0x3323c538) at libreoffice/sc/source/ui/view/tabview3.cxx:2248
 #6  0x00007fe00731c9ae in ScTabView::UpdateFormulas (this=this@entry=0x3323c538, nStartCol=nStartCol@entry=-1, nStartRow=nStartRow@entry=-1, nEndCol=nEndCol@entry=-1, nEndRow=nEndRow@entry=-1)
     at libreoffice/sc/source/ui/view/tabview3.cxx:2393
 #7  0x00007fe007338bc5 in ScTabViewShell::Notify (this=0x3323c330, rBC=..., rHint=...) at libreoffice/sc/source/ui/view/tabvwsh5.cxx:219
 #8  0x00007fe017a29bb9 in SfxBroadcaster::Broadcast (this=this@entry=0x2fd10a70, rHint=...) at libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
 #9  0x00007fe006f27c3f in ScDocShell::PostDataChanged (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh3.cxx:95
 #10 0x00007fe006f17dfc in ScDocShell::SetDocumentModified (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh.cxx:3050
 #11 0x00007fe007382e7c in ScViewFunc::DeleteTables (this=this@entry=0x3464aa28, TheTabs=std::vector of length 1, capacity 1 = {...}, bRecord=<optimized out>, bRecord@entry=true)
     at libreoffice/sc/source/ui/view/viewfun2.cxx:2656
 #12 0x00007fe007350825 in ScTabViewShell::ExecuteTable (this=0x3464a820, rReq=...) at libreoffice/sc/source/ui/view/tabvwshf.cxx:910
 #13 0x00007fe0175d0cef in SfxDispatcher::Call_Impl (this=0x340a1b70, rShell=..., rSlot=..., rReq=..., bRecord=<optimized out>)
     at libreoffice/sfx2/source/control/dispatch.cxx:254
 #14 0x00007fe0175d8daa in SfxDispatcher::Execute (this=0x340a1b70, nSlot=<optimized out>, nCall=nCall@entry=SfxCallMode::RECORD, pArgs=pArgs@entry=0x7ffe3c51edf0, pInternalArgs=pInternalArgs@entry=0x7ffe3c51ed90, nModi=0)
     at libreoffice/sfx2/source/control/dispatch.cxx:813
 #15 0x00007fe0176166f5 in SfxDispatchController_Impl::dispatch (this=<optimized out>, aURL=..., aArgs=uno::Sequence of length 1 = {...}, rListener=empty uno::Reference)
    at libreoffice/include/sfx2/ctrlitem.hxx:63

Change-Id: Ib4851414a277a293d6bc44b4ffcd33d332e3c57e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173256
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 13, 2024
warn and use the default pool pattern if this happens

 #0  WhichRangesContainer::getOffsetFromWhich (this=this@entry=0x38, nWhich=nWhich@entry=129) at libreoffice/svl/source/items/itemset.cxx:1895
 #1  0x00007fe0179fa4ac in SfxItemSet::Get (this=0x10, nWhich=129, bSrchInParent=<optimized out>) at libreoffice/svl/source/items/itemset.cxx:1152
 #2  0x00007fe00736aa2e in ScPatternAttr::GetItem (nWhichP=129, this=0x0) at libreoffice/sc/inc/patattr.hxx:71
 #3  ScPatternAttr::GetItem<SvxHorJustifyItem> (nWhich=..., this=0x0) at libreoffice/sc/inc/patattr.hxx:73
 #4  ScViewData::SetEditEngine (this=this@entry=0x3323c540, eWhich=eWhich@entry=SC_SPLIT_BOTTOMLEFT, pNewEngine=<optimized out>, pWin=pWin@entry=0x32eec4f0, nNewX=nNewX@entry=-1, nNewY=nNewY@entry=-1)
     at libreoffice/sc/source/ui/view/viewdata.cxx:1613
 #5  0x00007fe00731c2f1 in ScTabView::UpdateEditView (this=this@entry=0x3323c538) at libreoffice/sc/source/ui/view/tabview3.cxx:2248
 #6  0x00007fe00731c9ae in ScTabView::UpdateFormulas (this=this@entry=0x3323c538, nStartCol=nStartCol@entry=-1, nStartRow=nStartRow@entry=-1, nEndCol=nEndCol@entry=-1, nEndRow=nEndRow@entry=-1)
     at libreoffice/sc/source/ui/view/tabview3.cxx:2393
 #7  0x00007fe007338bc5 in ScTabViewShell::Notify (this=0x3323c330, rBC=..., rHint=...) at libreoffice/sc/source/ui/view/tabvwsh5.cxx:219
 #8  0x00007fe017a29bb9 in SfxBroadcaster::Broadcast (this=this@entry=0x2fd10a70, rHint=...) at libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
 #9  0x00007fe006f27c3f in ScDocShell::PostDataChanged (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh3.cxx:95
 #10 0x00007fe006f17dfc in ScDocShell::SetDocumentModified (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh.cxx:3050
 #11 0x00007fe007382e7c in ScViewFunc::DeleteTables (this=this@entry=0x3464aa28, TheTabs=std::vector of length 1, capacity 1 = {...}, bRecord=<optimized out>, bRecord@entry=true)
     at libreoffice/sc/source/ui/view/viewfun2.cxx:2656
 #12 0x00007fe007350825 in ScTabViewShell::ExecuteTable (this=0x3464a820, rReq=...) at libreoffice/sc/source/ui/view/tabvwshf.cxx:910
 #13 0x00007fe0175d0cef in SfxDispatcher::Call_Impl (this=0x340a1b70, rShell=..., rSlot=..., rReq=..., bRecord=<optimized out>)
     at libreoffice/sfx2/source/control/dispatch.cxx:254
 #14 0x00007fe0175d8daa in SfxDispatcher::Execute (this=0x340a1b70, nSlot=<optimized out>, nCall=nCall@entry=SfxCallMode::RECORD, pArgs=pArgs@entry=0x7ffe3c51edf0, pInternalArgs=pInternalArgs@entry=0x7ffe3c51ed90, nModi=0)
     at libreoffice/sfx2/source/control/dispatch.cxx:813
 #15 0x00007fe0176166f5 in SfxDispatchController_Impl::dispatch (this=<optimized out>, aURL=..., aArgs=uno::Sequence of length 1 = {...}, rListener=empty uno::Reference)
    at libreoffice/include/sfx2/ctrlitem.hxx:63

Change-Id: Ib4851414a277a293d6bc44b4ffcd33d332e3c57e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173256
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 13, 2024
warn and use the default pool pattern if this happens

 #0  WhichRangesContainer::getOffsetFromWhich (this=this@entry=0x38, nWhich=nWhich@entry=129) at libreoffice/svl/source/items/itemset.cxx:1895
 #1  0x00007fe0179fa4ac in SfxItemSet::Get (this=0x10, nWhich=129, bSrchInParent=<optimized out>) at libreoffice/svl/source/items/itemset.cxx:1152
 #2  0x00007fe00736aa2e in ScPatternAttr::GetItem (nWhichP=129, this=0x0) at libreoffice/sc/inc/patattr.hxx:71
 #3  ScPatternAttr::GetItem<SvxHorJustifyItem> (nWhich=..., this=0x0) at libreoffice/sc/inc/patattr.hxx:73
 #4  ScViewData::SetEditEngine (this=this@entry=0x3323c540, eWhich=eWhich@entry=SC_SPLIT_BOTTOMLEFT, pNewEngine=<optimized out>, pWin=pWin@entry=0x32eec4f0, nNewX=nNewX@entry=-1, nNewY=nNewY@entry=-1)
     at libreoffice/sc/source/ui/view/viewdata.cxx:1613
 #5  0x00007fe00731c2f1 in ScTabView::UpdateEditView (this=this@entry=0x3323c538) at libreoffice/sc/source/ui/view/tabview3.cxx:2248
 #6  0x00007fe00731c9ae in ScTabView::UpdateFormulas (this=this@entry=0x3323c538, nStartCol=nStartCol@entry=-1, nStartRow=nStartRow@entry=-1, nEndCol=nEndCol@entry=-1, nEndRow=nEndRow@entry=-1)
     at libreoffice/sc/source/ui/view/tabview3.cxx:2393
 #7  0x00007fe007338bc5 in ScTabViewShell::Notify (this=0x3323c330, rBC=..., rHint=...) at libreoffice/sc/source/ui/view/tabvwsh5.cxx:219
 #8  0x00007fe017a29bb9 in SfxBroadcaster::Broadcast (this=this@entry=0x2fd10a70, rHint=...) at libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
 #9  0x00007fe006f27c3f in ScDocShell::PostDataChanged (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh3.cxx:95
 #10 0x00007fe006f17dfc in ScDocShell::SetDocumentModified (this=this@entry=0x2fd10a70) at libreoffice/sc/source/ui/docshell/docsh.cxx:3050
 #11 0x00007fe007382e7c in ScViewFunc::DeleteTables (this=this@entry=0x3464aa28, TheTabs=std::vector of length 1, capacity 1 = {...}, bRecord=<optimized out>, bRecord@entry=true)
     at libreoffice/sc/source/ui/view/viewfun2.cxx:2656
 #12 0x00007fe007350825 in ScTabViewShell::ExecuteTable (this=0x3464a820, rReq=...) at libreoffice/sc/source/ui/view/tabvwshf.cxx:910
 #13 0x00007fe0175d0cef in SfxDispatcher::Call_Impl (this=0x340a1b70, rShell=..., rSlot=..., rReq=..., bRecord=<optimized out>)
     at libreoffice/sfx2/source/control/dispatch.cxx:254
 #14 0x00007fe0175d8daa in SfxDispatcher::Execute (this=0x340a1b70, nSlot=<optimized out>, nCall=nCall@entry=SfxCallMode::RECORD, pArgs=pArgs@entry=0x7ffe3c51edf0, pInternalArgs=pInternalArgs@entry=0x7ffe3c51ed90, nModi=0)
     at libreoffice/sfx2/source/control/dispatch.cxx:813
 #15 0x00007fe0176166f5 in SfxDispatchController_Impl::dispatch (this=<optimized out>, aURL=..., aArgs=uno::Sequence of length 1 = {...}, rListener=empty uno::Reference)
    at libreoffice/include/sfx2/ctrlitem.hxx:63

Change-Id: Ib4851414a277a293d6bc44b4ffcd33d332e3c57e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173183
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 1943771)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173293
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf-gerrit pushed a commit that referenced this pull request Sep 15, 2024
 #0  SwDocShell::GetWrtShell (this=0x0) at sw/inc/docsh.hxx:226
 #1  SwXTextDocument::initializeForTiledRendering(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
     at sw/source/uibase/uno/unotxdoc.cxx:3634
 #2  0x00007f6bb1d40734 in doc_initializeForRendering () at include/com/sun/star/uno/Type.h:163
 #3  0x00000000005d7988 in lok::Document::initializeForRendering (
     pArguments=0x342d0e48 "{\".uno:Author\":{\"type\":\"string\",\"value\":\"1(访客)\"},\".uno:ChangeTheme\":{\"type\":\"string\",\"value\":\"Light\"},\".uno:InvertBackground\":{\"type\":\"string\",\"value\":\"Light\"}}", this=<optimized out>) at /home/collabora/jenkins/workspace/package_cool_24.04_rpm/rpmbuild/BUILD/coolwsd-24.04.7.2snapshot/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx:245
 #4  Document::load(std::shared_ptr<ChildSession> const&, std::string const&) () at kit/Kit.cpp:1949
 #5  0x00000000005da3b2 in Document::onLoad(std::string const&, std::string const&, std::string const&) () at kit/Kit.cpp:1226
 #6  0x000000000057f7c1 in ChildSession::loadDocument(StringVector const&) () at kit/ChildSession.cpp:906
 #7  0x0000000000586464 in ChildSession::_handleInput(char const*, int) () at kit/ChildSession.cpp:298
 #8  0x0000000000613e48 in Session::handleMessage(std::vector<char, std::allocator<char> > const&) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:987
 #9  0x00000000005c67ac in Document::forwardToChild(std::string const&, std::vector<char, std::allocator<char> > const&) () at kit/Kit.cpp:2052
 #10 0x00000000005c7b29 in Document::drainQueue() () at kit/Kit.cpp:2279
 #11 0x00000000005c80d8 in KitSocketPoll::drainQueue (this=0x34316d30) at kit/Kit.cpp:2676

Change-Id: I6f18f1a542ca96fe3fda0248e15ee1254eb9ca95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173386
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 15, 2024
got a case similar to

pnggroup/libpng#587

with a backtrace of:

/work/workdir/UnpackedTarball/libpng/png.c:1475:23: runtime error: signed integer overflow: -1703155269 - 692774662 cannot be represented in type 'png_fixed_point' (aka 'int')
 #0 0x59bbf901eab0 in png_XYZ_from_xy /work/workdir/UnpackedTarball/libpng/png.c:1475:23
 #1 0x59bbf901eab0 in png_colorspace_check_xy /work/workdir/UnpackedTarball/libpng/png.c:1610:13
 #2 0x59bbf901d8bc in png_colorspace_set_chromaticities /work/workdir/UnpackedTarball/libpng/png.c:1717:12
 #3 0x59bbf9046855 in png_handle_cHRM /work/workdir/UnpackedTarball/libpng/pngrutil.c:1302:10
 #4 0x59bbf902d064 in png_read_info /work/workdir/UnpackedTarball/libpng/pngread.c:175:10
 #5 0x59bbf7c331d6 in (anonymous namespace)::reader(SvStream&, Graphic&, GraphicFilterImportFlags, BitmapScopedWriteAccess*, BitmapScopedWriteAccess*) /src/libreoffice/vcl/source/filter/png/PngImageReader.cxx:404:5
 #6 0x59bbf7c36960 in read /src/libreoffice/vcl/source/filter/png/PngImageReader.cxx:845:55
 #7 0x59bbf7c36960 in vcl::PngImageReader::read() /src/libreoffice/vcl/source/filter/png/PngImageReader.cxx:850:5
 #8 0x59bbf786fe57 in LLVMFuzzerTestOneInput /src/libreoffice/vcl/workben/pngfuzzer.cxx:52:19

(gdb) print *xy
$1 = {
  redx = 9,
  redy = 131616,
  greenx = 598048,
  greeny = 538976288,
  bluex = 0,
  bluey = 151551,
  whitex = 538976288,
  whitey = 538976288
}

but not reproducible with a typical utility because we're unusually
ignoring crc errors for fuzzing so reenable those and see if a testcase
can be generated anyway.

Change-Id: Ifc050ee082800906b087609154ec29ca39cd8fe6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173409
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 16, 2024
 #0  SwDocShell::GetWrtShell (this=0x0) at sw/inc/docsh.hxx:226
 #1  SwXTextDocument::initializeForTiledRendering(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
     at sw/source/uibase/uno/unotxdoc.cxx:3634
 #2  0x00007f6bb1d40734 in doc_initializeForRendering () at include/com/sun/star/uno/Type.h:163
 #3  0x00000000005d7988 in lok::Document::initializeForRendering (
     pArguments=0x342d0e48 "{\".uno:Author\":{\"type\":\"string\",\"value\":\"1(访客)\"},\".uno:ChangeTheme\":{\"type\":\"string\",\"value\":\"Light\"},\".uno:InvertBackground\":{\"type\":\"string\",\"value\":\"Light\"}}", this=<optimized out>) at /home/collabora/jenkins/workspace/package_cool_24.04_rpm/rpmbuild/BUILD/coolwsd-24.04.7.2snapshot/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx:245
 #4  Document::load(std::shared_ptr<ChildSession> const&, std::string const&) () at kit/Kit.cpp:1949
 #5  0x00000000005da3b2 in Document::onLoad(std::string const&, std::string const&, std::string const&) () at kit/Kit.cpp:1226
 #6  0x000000000057f7c1 in ChildSession::loadDocument(StringVector const&) () at kit/ChildSession.cpp:906
 #7  0x0000000000586464 in ChildSession::_handleInput(char const*, int) () at kit/ChildSession.cpp:298
 #8  0x0000000000613e48 in Session::handleMessage(std::vector<char, std::allocator<char> > const&) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:987
 #9  0x00000000005c67ac in Document::forwardToChild(std::string const&, std::vector<char, std::allocator<char> > const&) () at kit/Kit.cpp:2052
 #10 0x00000000005c7b29 in Document::drainQueue() () at kit/Kit.cpp:2279
 #11 0x00000000005c80d8 in KitSocketPoll::drainQueue (this=0x34316d30) at kit/Kit.cpp:2676

Change-Id: I6f18f1a542ca96fe3fda0248e15ee1254eb9ca95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173364
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 16, 2024
 #0  SwDocShell::GetWrtShell (this=0x0) at sw/inc/docsh.hxx:226
 #1  SwXTextDocument::initializeForTiledRendering(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
     at sw/source/uibase/uno/unotxdoc.cxx:3634
 #2  0x00007f6bb1d40734 in doc_initializeForRendering () at include/com/sun/star/uno/Type.h:163
 #3  0x00000000005d7988 in lok::Document::initializeForRendering (
     pArguments=0x342d0e48 "{\".uno:Author\":{\"type\":\"string\",\"value\":\"1(访客)\"},\".uno:ChangeTheme\":{\"type\":\"string\",\"value\":\"Light\"},\".uno:InvertBackground\":{\"type\":\"string\",\"value\":\"Light\"}}", this=<optimized out>) at /home/collabora/jenkins/workspace/package_cool_24.04_rpm/rpmbuild/BUILD/coolwsd-24.04.7.2snapshot/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx:245
 #4  Document::load(std::shared_ptr<ChildSession> const&, std::string const&) () at kit/Kit.cpp:1949
 #5  0x00000000005da3b2 in Document::onLoad(std::string const&, std::string const&, std::string const&) () at kit/Kit.cpp:1226
 #6  0x000000000057f7c1 in ChildSession::loadDocument(StringVector const&) () at kit/ChildSession.cpp:906
 #7  0x0000000000586464 in ChildSession::_handleInput(char const*, int) () at kit/ChildSession.cpp:298
 #8  0x0000000000613e48 in Session::handleMessage(std::vector<char, std::allocator<char> > const&) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:987
 #9  0x00000000005c67ac in Document::forwardToChild(std::string const&, std::vector<char, std::allocator<char> > const&) () at kit/Kit.cpp:2052
 #10 0x00000000005c7b29 in Document::drainQueue() () at kit/Kit.cpp:2279
 #11 0x00000000005c80d8 in KitSocketPoll::drainQueue (this=0x34316d30) at kit/Kit.cpp:2676

Change-Id: I6f18f1a542ca96fe3fda0248e15ee1254eb9ca95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173364
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 9e30eb5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173392
tdf-gerrit pushed a commit that referenced this pull request Sep 17, 2024
 #0  SwDocShell::GetWrtShell (this=0x0) at sw/inc/docsh.hxx:226
 #1  SwXTextDocument::initializeForTiledRendering(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
     at sw/source/uibase/uno/unotxdoc.cxx:3634
 #2  0x00007f6bb1d40734 in doc_initializeForRendering () at include/com/sun/star/uno/Type.h:163
 #3  0x00000000005d7988 in lok::Document::initializeForRendering (
     pArguments=0x342d0e48 "{\".uno:Author\":{\"type\":\"string\",\"value\":\"1(访客)\"},\".uno:ChangeTheme\":{\"type\":\"string\",\"value\":\"Light\"},\".uno:InvertBackground\":{\"type\":\"string\",\"value\":\"Light\"}}", this=<optimized out>) at /home/collabora/jenkins/workspace/package_cool_24.04_rpm/rpmbuild/BUILD/coolwsd-24.04.7.2snapshot/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx:245
 #4  Document::load(std::shared_ptr<ChildSession> const&, std::string const&) () at kit/Kit.cpp:1949
 #5  0x00000000005da3b2 in Document::onLoad(std::string const&, std::string const&, std::string const&) () at kit/Kit.cpp:1226
 #6  0x000000000057f7c1 in ChildSession::loadDocument(StringVector const&) () at kit/ChildSession.cpp:906
 #7  0x0000000000586464 in ChildSession::_handleInput(char const*, int) () at kit/ChildSession.cpp:298
 #8  0x0000000000613e48 in Session::handleMessage(std::vector<char, std::allocator<char> > const&) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:987
 #9  0x00000000005c67ac in Document::forwardToChild(std::string const&, std::vector<char, std::allocator<char> > const&) () at kit/Kit.cpp:2052
 #10 0x00000000005c7b29 in Document::drainQueue() () at kit/Kit.cpp:2279
 #11 0x00000000005c80d8 in KitSocketPoll::drainQueue (this=0x34316d30) at kit/Kit.cpp:2676

Change-Id: I6f18f1a542ca96fe3fda0248e15ee1254eb9ca95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173386
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 089640f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173389
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Sep 19, 2024
At least with one ASan/UBSan setup of mine using LODE's Clang 12.0.1,
./autogen.sh would occasionally detect -std=gnu11 as the required CC "option to
enable C11 features" (which would in turn cause building external/firebird to
fail oddly; an issue worth investigations of its own), because Clang would
occasionally crash with a SEGV on the corresponding configure test program's
first invocation (without -std=gnu11) when invoked with -O2 (and happen to
succeed on second invocation with -std=gnu11, so configure thinks that's
needed), see below for a relevant config.log excerpt.

When CC/CXX are already set (as is the case in this scenario), we could arguably
skip the AC_PROG_CC/CXX checks entirely (and thus avoid configure potentially
adding -std=gnu11 to CC), but at least AC_PROG_CC also internally sets the GCC
shell var, which we use in configure.ac.  So better be conservative and just
avoid -O2 during AC_PROG_CC/CXX (whatever the autoconf motivation to include it
in the first place).

> configure:8165: checking for /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist option to enable C11 features
> configure:8180: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist  -c -g -O2  conftest.c >&5
> PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
> Stack dump:
> 0.	Program arguments: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist -c -g -O2 conftest.c
> 1.	<eof> parser at end of file
> 2.	Code generation
>  #0 0x000055f3a890caf2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1c3eaf2)
>  #1 0x000055f3a890a734 llvm::sys::RunSignalHandlers() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1c3c734)
>  #2 0x000055f3a887b998 CrashRecoverySignalHandler(int) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1bad998)
>  #3 0x00007f750d24e520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
>  #4 0x000055f3a93f9cd4 llvm::DIE::getUnitDie() const (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x272bcd4)
>  #5 0x000055f3a9404574 llvm::DwarfDebug::finishEntityDefinitions() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2736574)
>  #6 0x000055f3a941df99 llvm::DwarfDebug::finalizeModuleInfo() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x274ff99)
>  #7 0x000055f3a9421128 llvm::DwarfDebug::endModule() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2753128)
>  #8 0x000055f3a93f1219 llvm::AsmPrinter::doFinalization(llvm::Module&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2723219)
>  #9 0x000055f3a82478f5 llvm::FPPassManager::doFinalization(llvm::Module&) (.localalias) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x15798f5)
> #10 0x000055f3a8253900 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1585900)
> #11 0x000055f3a8bb57d3 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (.constprop.0) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1ee77d3)
> #12 0x000055f3a8bb76ea clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1ee96ea)
> #13 0x000055f3a9825876 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2b57876)
> #14 0x000055f3aa35c549 clang::ParseAST(clang::Sema&, bool, bool) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x368e549)
> #15 0x000055f3a91ef2d9 clang::FrontendAction::Execute() (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x25212d9)
> #16 0x000055f3a91903a3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x24c23a3)
> #17 0x000055f3a92a2fd8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x25d4fd8)
> #18 0x000055f3a7798815 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xaca815)
> #19 0x000055f3a77961a7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xac81a7)
> #20 0x000055f3a9039689 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x236b689)
> #21 0x000055f3a887baa7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x1badaa7)
> #22 0x000055f3a903a802 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.0) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x236c802)
> #23 0x000055f3a900fbec clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2341bec)
> #24 0x000055f3a9010679 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x2342679)
> #25 0x000055f3a901e8f1 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0x23508f1)
> #26 0x000055f3a7717e6f main (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xa49e6f)
> #27 0x00007f750d235d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
> #28 0x00007f750d235e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
> #29 0x000055f3a7795b55 _start (/home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang+0xac7b55)
> clang-12: error: clang frontend command failed with exit code 139 (use -v to see invocation)
> clang version 12.0.1 (https://github.com/llvm/llvm-project.git fed41342a82f5a3a9201819a82bf7a48313e296b)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin
> clang-12: note: diagnostic msg:
> ********************
>
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang-12: note: diagnostic msg: /tmp/conftest-968380.c
> clang-12: note: diagnostic msg: /tmp/conftest-968380.sh
> clang-12: note: diagnostic msg:
>
> ********************
> configure:8180: $? = 139
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "LibreOffice"
> | #define PACKAGE_TARNAME "libreoffice"
> | #define PACKAGE_VERSION "24.8.0.0.alpha0+"
> | #define PACKAGE_STRING "LibreOffice 24.8.0.0.alpha0+"
> | #define PACKAGE_BUGREPORT ""
> | #define PACKAGE_URL "http://documentfoundation.org/"
> | #define LIBO_VERSION_MAJOR 24
> | #define LIBO_VERSION_MINOR 8
> | #define LIBO_VERSION_MICRO 0
> | #define LIBO_VERSION_PATCH 0
> | #define LIBO_THIS_YEAR 2024
> | #define SRCDIR "/home/sberg/lo0/core"
> | #define SRC_ROOT "/home/sberg/lo0/core"
> | #define BUILDDIR "/home/sberg/lo0/core"
> | #define USE_HEADLESS_CODE 1
> | #define ENABLE_HEADLESS 1
> | /* end confdefs.h.  */
> |
> | /* Does the compiler advertise C89 conformance?
> |    Do not test the value of __STDC__, because some compilers set it to 0
> |    while being otherwise adequately conformant. */
> | #if !defined __STDC__
> | # error "Compiler does not advertise C89 conformance"
> | #endif
> |
> | #include <stddef.h>
> | #include <stdarg.h>
> | struct stat;
> | /* Most of the following tests are stolen from RCS 5.7 src/conf.sh.  */
> | struct buf { int x; };
> | struct buf * (*rcsopen) (struct buf *, struct stat *, int);
> | static char *e (p, i)
> |      char **p;
> |      int i;
> | {
> |   return p[i];
> | }
> | static char *f (char * (*g) (char **, int), char **p, ...)
> | {
> |   char *s;
> |   va_list v;
> |   va_start (v,p);
> |   s = g (p, va_arg (v,int));
> |   va_end (v);
> |   return s;
> | }
> |
> | /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
> |    function prototypes and stuff, but not \xHH hex character constants.
> |    These do not provoke an error unfortunately, instead are silently treated
> |    as an "x".  The following induces an error, until -std is added to get
> |    proper ANSI mode.  Curiously \x00 != x always comes out true, for an
> |    array size at least.  It is necessary to write \x00 == 0 to get something
> |    that is true only with -std.  */
> | int osf4_cc_array ['\x00' == 0 ? 1 : -1];
> |
> | /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
> |    inside strings and character constants.  */
> | #define FOO(x) 'x'
> | int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
> |
> | int test (int i, double x);
> | struct s1 {int (*f) (int a);};
> | struct s2 {int (*f) (double a);};
> | int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
> |                int, int);
> |
> | // Does the compiler advertise C99 conformance?
> | #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
> | # error "Compiler does not advertise C99 conformance"
> | #endif
> |
> | #include <stdbool.h>
> | extern int puts (const char *);
> | extern int printf (const char *, ...);
> | extern int dprintf (int, const char *, ...);
> | extern void *malloc (size_t);
> |
> | // Check varargs macros.  These examples are taken from C99 6.10.3.5.
> | // dprintf is used instead of fprintf to avoid needing to declare
> | // FILE and stderr.
> | #define debug(...) dprintf (2, __VA_ARGS__)
> | #define showlist(...) puts (#__VA_ARGS__)
> | #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
> | static void
> | test_varargs_macros (void)
> | {
> |   int x = 1234;
> |   int y = 5678;
> |   debug ("Flag");
> |   debug ("X = %d\n", x);
> |   showlist (The first, second, and third items.);
> |   report (x>y, "x is %d but y is %d", x, y);
> | }
> |
> | // Check long long types.
> | #define BIG64 18446744073709551615ull
> | #define BIG32 4294967295ul
> | #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
> | #if !BIG_OK
> |   #error "your preprocessor is broken"
> | #endif
> | #if BIG_OK
> | #else
> |   #error "your preprocessor is broken"
> | #endif
> | static long long int bignum = -9223372036854775807LL;
> | static unsigned long long int ubignum = BIG64;
> |
> | struct incomplete_array
> | {
> |   int datasize;
> |   double data[];
> | };
> |
> | struct named_init {
> |   int number;
> |   const wchar_t *name;
> |   double average;
> | };
> |
> | typedef const char *ccp;
> |
> | static inline int
> | test_restrict (ccp restrict text)
> | {
> |   // See if C++-style comments work.
> |   // Iterate through items via the restricted pointer.
> |   // Also check for declarations in for loops.
> |   for (unsigned int i = 0; *(text+i) != '\0'; ++i)
> |     continue;
> |   return 0;
> | }
> |
> | // Check varargs and va_copy.
> | static bool
> | test_varargs (const char *format, ...)
> | {
> |   va_list args;
> |   va_start (args, format);
> |   va_list args_copy;
> |   va_copy (args_copy, args);
> |
> |   const char *str = "";
> |   int number = 0;
> |   float fnumber = 0;
> |
> |   while (*format)
> |     {
> |       switch (*format++)
> | 	{
> | 	case 's': // string
> | 	  str = va_arg (args_copy, const char *);
> | 	  break;
> | 	case 'd': // int
> | 	  number = va_arg (args_copy, int);
> | 	  break;
> | 	case 'f': // float
> | 	  fnumber = va_arg (args_copy, double);
> | 	  break;
> | 	default:
> | 	  break;
> | 	}
> |     }
> |   va_end (args_copy);
> |   va_end (args);
> |
> |   return *str && number && fnumber;
> | }
> |
> |
> | // Does the compiler advertise C11 conformance?
> | #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
> | # error "Compiler does not advertise C11 conformance"
> | #endif
> |
> | // Check _Alignas.
> | char _Alignas (double) aligned_as_double;
> | char _Alignas (0) no_special_alignment;
> | extern char aligned_as_int;
> | char _Alignas (0) _Alignas (int) aligned_as_int;
> |
> | // Check _Alignof.
> | enum
> | {
> |   int_alignment = _Alignof (int),
> |   int_array_alignment = _Alignof (int[100]),
> |   char_alignment = _Alignof (char)
> | };
> | _Static_assert (0 < -_Alignof (int), "_Alignof is signed");
> |
> | // Check _Noreturn.
> | int _Noreturn does_not_return (void) { for (;;) continue; }
> |
> | // Check _Static_assert.
> | struct test_static_assert
> | {
> |   int x;
> |   _Static_assert (sizeof (int) <= sizeof (long int),
> |                   "_Static_assert does not work in struct");
> |   long int y;
> | };
> |
> | // Check UTF-8 literals.
> | #define u8 syntax error!
> | char const utf8_literal[] = u8"happens to be ASCII" "another string";
> |
> | // Check duplicate typedefs.
> | typedef long *long_ptr;
> | typedef long int *long_ptr;
> | typedef long_ptr long_ptr;
> |
> | // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
> | struct anonymous
> | {
> |   union {
> |     struct { int i; int j; };
> |     struct { int k; long int l; } w;
> |   };
> |   int m;
> | } v1;
> |
> |
> | int
> | main (int argc, char **argv)
> | {
> |   int ok = 0;
> |
> | ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
> |
> |
> |   // Check bool.
> |   _Bool success = false;
> |   success |= (argc != 0);
> |
> |   // Check restrict.
> |   if (test_restrict ("String literal") == 0)
> |     success = true;
> |   char *restrict newvar = "Another string";
> |
> |   // Check varargs.
> |   success &= test_varargs ("s, d' f .", "string", 65, 34.234);
> |   test_varargs_macros ();
> |
> |   // Check flexible array members.
> |   struct incomplete_array *ia =
> |     malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
> |   ia->datasize = 10;
> |   for (int i = 0; i < ia->datasize; ++i)
> |     ia->data[i] = i * 1.234;
> |
> |   // Check named initializers.
> |   struct named_init ni = {
> |     .number = 34,
> |     .name = L"Test wide string",
> |     .average = 543.34343,
> |   };
> |
> |   ni.number = 58;
> |
> |   int dynamic_array[ni.number];
> |   dynamic_array[0] = argv[0][0];
> |   dynamic_array[ni.number - 1] = 543;
> |
> |   // work around unused variable warnings
> |   ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
> | 	 || dynamic_array[ni.number - 1] != 543);
> |
> |
> |   _Static_assert ((offsetof (struct anonymous, i)
> | 		   == offsetof (struct anonymous, w.k)),
> | 		  "Anonymous union alignment botch");
> |   v1.i = 2;
> |   v1.w.k = 5;
> |   ok |= v1.i != 5;
> |
> |   return ok;
> | }
> |
> configure:8180: /home/builder/lode/opt_private/clang-llvmorg-12.0.1/bin/clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=/home/sberg/lo0/core/sanitize-ubsan-excludelist -std=gnu11 -c -g -O2  conftest.c >&5
> configure:8180: $? = 0
> configure:8201: result: -std=gnu11

Change-Id: I9122d0d853d0010155d57cb1d1d56f7c453d5208
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165904
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
(cherry picked from commit 42f6e89)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173098
Tested-by: allotropia jenkins <jenkins@allotropia.de>
tdf-gerrit pushed a commit that referenced this pull request Sep 19, 2024
...in code newly introduced in 135ce25
"tdf#146487 Don't show generic diagram title when there is an empty title
given", which caused CppunitTest_chart2_export2 to fail with

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

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

Change-Id: I870d811e78b8c55b84627ae609f98f623465dd9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162294
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
(cherry picked from commit 3fb9859)
tdf-gerrit pushed a commit that referenced this pull request Sep 25, 2024
we want this to get through because of a scenario like

 #0  ignoreLibreOfficeKitViewCallback (nType=13, pImpl=0xf9bd620) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/viewsh.cxx:3219
 #1  0x00007fd4a2428979 in SfxViewShell::libreOfficeKitViewCallback (this=0xf9bd090, nType=13, pPayload=...) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/viewsh.cxx:3278
 #2  0x00007fd4a23ab80b in SfxLokHelper::notifyDocumentSizeChanged (pThisView=0xf9bd090, rPayload=..., pDoc=0xec53578, bInvalidateAll=true) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/lokhelper.cxx:711
 #3  0x00007fd484eba265 in SwViewShell::SizeChgNotify (this=0xf9bf3c0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:1154
 #4  0x00007fd484775a62 in AdjustSizeChgNotify (pRoot=0xed16880) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:842
 #5  0x00007fd48477e029 in SwRootFrame::CheckViewLayout (this=0xed16880, pViewOpt=0x0, pVisArea=0x0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:2436
 #6  0x00007fd484775da2 in SwPageFrame::Cut (this=0x120350f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:914
 #7  0x00007fd484779ec8 in SwRootFrame::RemovePage (this=0xed16880, pDelRef=0x7ffe90279548, eResult=SwRemoveResult::Prev) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:1511
 #8  0x00007fd48477a187 in SwRootFrame::RemoveSuperfluous (this=0xed16880) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:1550
 #9  0x00007fd4847336b2 in SwLayAction::InternalAction (this=0x7ffe90279a60, pRenderContext=0xf9bb5f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/layact.cxx:694
 #10 0x00007fd4847323b8 in SwLayAction::Action (this=0x7ffe90279a60, pRenderContext=0xf9bb5f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/layact.cxx:396
 #11 0x00007fd484eb5fc2 in SwViewShell::ImplEndAction (this=0xf9bf3c0, bIdleEnd=false) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:309
 #12 0x00007fd483fa3f78 in SwViewShell::EndAction (this=0xf9bf3c0, bIdleEnd=false) at /home/caolan/LibreOffice/co-24.04/sw/inc/viewsh.hxx:637
 #13 0x00007fd484ebf56b in SwViewShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:2235
 #14 0x00007fd484577013 in SwEditShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/core/edit/editsh.cxx:1094
 #15 0x00007fd48574a5cf in SwWrtShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/uibase/wrtsh/wrtsh1.cxx:2137
 #16 0x00007fd484ebe79e in SwViewShell::PaintTile (this=0xeddec90, rDevice=..., contextWidth=1792, contextHeight=768, tilePosX=0, tilePosY=113280, tileWidth=13440, tileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:2019
 #17 0x00007fd4855fc5f0 in SwXTextDocument::paintTile (this=0xec53280, rDevice=..., nOutputWidth=1792, nOutputHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/sw/source/uibase/uno/unotxdoc.cxx:3145
 #18 0x00007fd4a24c5ada in doc_paintTile (pThis=0xed2fa10, pBuffer=0x12871f30 "", nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/desktop/source/lib/init.cxx:4431
 #19 0x00007fd4a24c6bb3 in doc_paintPartTile (pThis=0xed2fa10, pBuffer=0x12871f30 "", nPart=0, nMode=0, nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/desktop/source/lib/init.cxx:4629
 #20 0x00000000005f0f0e in lok::Document::paintPartTile (this=0xf521420, pBuffer=0x12871f30 "", nPart=0, nMode=0, nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/include/LibreOfficeKit/LibreOfficeKit.hxx:621
 #21 0x00000000005c2627 in RenderTiles::doRender(std::shared_ptr<lok::Document> const&, DeltaGenerator&, TileCombined&, ThreadPool&, std::function<void (unsigned char*, int, int, unsigned long, unsigned long, int, int, LibreOfficeKitTileMode)> const&, std::function<void (char const*, unsigned long)> const&, unsigned int, int, bool) (document=..., deltaGen=..., tileCombined=..., pngPool=..., blendWatermark=..., outputMessage=...,
     mobileAppDocId=3, canonicalViewId=1000, dumpTiles=false) at ./common/RenderTiles.hpp:123
 #22 0x00000000005cd29d in Document::renderTiles (this=0xe6eefc0, tileCombined=...) at kit/Kit.cpp:933

where otherwise the browser gets no update of the document size.

Change-Id: I396daa9c7ee5c306ee107839f6fba6b26a70683d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173936
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 25, 2024
we want this to get through because of a scenario like

 #0  ignoreLibreOfficeKitViewCallback (nType=13, pImpl=0xf9bd620) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/viewsh.cxx:3219
 #1  0x00007fd4a2428979 in SfxViewShell::libreOfficeKitViewCallback (this=0xf9bd090, nType=13, pPayload=...) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/viewsh.cxx:3278
 #2  0x00007fd4a23ab80b in SfxLokHelper::notifyDocumentSizeChanged (pThisView=0xf9bd090, rPayload=..., pDoc=0xec53578, bInvalidateAll=true) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/lokhelper.cxx:711
 #3  0x00007fd484eba265 in SwViewShell::SizeChgNotify (this=0xf9bf3c0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:1154
 #4  0x00007fd484775a62 in AdjustSizeChgNotify (pRoot=0xed16880) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:842
 #5  0x00007fd48477e029 in SwRootFrame::CheckViewLayout (this=0xed16880, pViewOpt=0x0, pVisArea=0x0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:2436
 #6  0x00007fd484775da2 in SwPageFrame::Cut (this=0x120350f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:914
 #7  0x00007fd484779ec8 in SwRootFrame::RemovePage (this=0xed16880, pDelRef=0x7ffe90279548, eResult=SwRemoveResult::Prev) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:1511
 #8  0x00007fd48477a187 in SwRootFrame::RemoveSuperfluous (this=0xed16880) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:1550
 #9  0x00007fd4847336b2 in SwLayAction::InternalAction (this=0x7ffe90279a60, pRenderContext=0xf9bb5f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/layact.cxx:694
 #10 0x00007fd4847323b8 in SwLayAction::Action (this=0x7ffe90279a60, pRenderContext=0xf9bb5f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/layact.cxx:396
 #11 0x00007fd484eb5fc2 in SwViewShell::ImplEndAction (this=0xf9bf3c0, bIdleEnd=false) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:309
 #12 0x00007fd483fa3f78 in SwViewShell::EndAction (this=0xf9bf3c0, bIdleEnd=false) at /home/caolan/LibreOffice/co-24.04/sw/inc/viewsh.hxx:637
 #13 0x00007fd484ebf56b in SwViewShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:2235
 #14 0x00007fd484577013 in SwEditShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/core/edit/editsh.cxx:1094
 #15 0x00007fd48574a5cf in SwWrtShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/uibase/wrtsh/wrtsh1.cxx:2137
 #16 0x00007fd484ebe79e in SwViewShell::PaintTile (this=0xeddec90, rDevice=..., contextWidth=1792, contextHeight=768, tilePosX=0, tilePosY=113280, tileWidth=13440, tileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:2019
 #17 0x00007fd4855fc5f0 in SwXTextDocument::paintTile (this=0xec53280, rDevice=..., nOutputWidth=1792, nOutputHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/sw/source/uibase/uno/unotxdoc.cxx:3145
 #18 0x00007fd4a24c5ada in doc_paintTile (pThis=0xed2fa10, pBuffer=0x12871f30 "", nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/desktop/source/lib/init.cxx:4431
 #19 0x00007fd4a24c6bb3 in doc_paintPartTile (pThis=0xed2fa10, pBuffer=0x12871f30 "", nPart=0, nMode=0, nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/desktop/source/lib/init.cxx:4629
 #20 0x00000000005f0f0e in lok::Document::paintPartTile (this=0xf521420, pBuffer=0x12871f30 "", nPart=0, nMode=0, nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/include/LibreOfficeKit/LibreOfficeKit.hxx:621
 #21 0x00000000005c2627 in RenderTiles::doRender(std::shared_ptr<lok::Document> const&, DeltaGenerator&, TileCombined&, ThreadPool&, std::function<void (unsigned char*, int, int, unsigned long, unsigned long, int, int, LibreOfficeKitTileMode)> const&, std::function<void (char const*, unsigned long)> const&, unsigned int, int, bool) (document=..., deltaGen=..., tileCombined=..., pngPool=..., blendWatermark=..., outputMessage=...,
     mobileAppDocId=3, canonicalViewId=1000, dumpTiles=false) at ./common/RenderTiles.hpp:123
 #22 0x00000000005cd29d in Document::renderTiles (this=0xe6eefc0, tileCombined=...) at kit/Kit.cpp:933

where otherwise the browser gets no update of the document size.

Change-Id: I396daa9c7ee5c306ee107839f6fba6b26a70683d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173936
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 25, 2024
we want this to get through because of a scenario like

 #0  ignoreLibreOfficeKitViewCallback (nType=13, pImpl=0xf9bd620) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/viewsh.cxx:3219
 #1  0x00007fd4a2428979 in SfxViewShell::libreOfficeKitViewCallback (this=0xf9bd090, nType=13, pPayload=...) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/viewsh.cxx:3278
 #2  0x00007fd4a23ab80b in SfxLokHelper::notifyDocumentSizeChanged (pThisView=0xf9bd090, rPayload=..., pDoc=0xec53578, bInvalidateAll=true) at /home/caolan/LibreOffice/co-24.04/sfx2/source/view/lokhelper.cxx:711
 #3  0x00007fd484eba265 in SwViewShell::SizeChgNotify (this=0xf9bf3c0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:1154
 #4  0x00007fd484775a62 in AdjustSizeChgNotify (pRoot=0xed16880) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:842
 #5  0x00007fd48477e029 in SwRootFrame::CheckViewLayout (this=0xed16880, pViewOpt=0x0, pVisArea=0x0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:2436
 #6  0x00007fd484775da2 in SwPageFrame::Cut (this=0x120350f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:914
 #7  0x00007fd484779ec8 in SwRootFrame::RemovePage (this=0xed16880, pDelRef=0x7ffe90279548, eResult=SwRemoveResult::Prev) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:1511
 #8  0x00007fd48477a187 in SwRootFrame::RemoveSuperfluous (this=0xed16880) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/pagechg.cxx:1550
 #9  0x00007fd4847336b2 in SwLayAction::InternalAction (this=0x7ffe90279a60, pRenderContext=0xf9bb5f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/layact.cxx:694
 #10 0x00007fd4847323b8 in SwLayAction::Action (this=0x7ffe90279a60, pRenderContext=0xf9bb5f0) at /home/caolan/LibreOffice/co-24.04/sw/source/core/layout/layact.cxx:396
 #11 0x00007fd484eb5fc2 in SwViewShell::ImplEndAction (this=0xf9bf3c0, bIdleEnd=false) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:309
 #12 0x00007fd483fa3f78 in SwViewShell::EndAction (this=0xf9bf3c0, bIdleEnd=false) at /home/caolan/LibreOffice/co-24.04/sw/inc/viewsh.hxx:637
 #13 0x00007fd484ebf56b in SwViewShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:2235
 #14 0x00007fd484577013 in SwEditShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/core/edit/editsh.cxx:1094
 #15 0x00007fd48574a5cf in SwWrtShell::ApplyViewOptions (this=0xeddec90, rOpt=...) at /home/caolan/LibreOffice/co-24.04/sw/source/uibase/wrtsh/wrtsh1.cxx:2137
 #16 0x00007fd484ebe79e in SwViewShell::PaintTile (this=0xeddec90, rDevice=..., contextWidth=1792, contextHeight=768, tilePosX=0, tilePosY=113280, tileWidth=13440, tileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/sw/source/core/view/viewsh.cxx:2019
 #17 0x00007fd4855fc5f0 in SwXTextDocument::paintTile (this=0xec53280, rDevice=..., nOutputWidth=1792, nOutputHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/sw/source/uibase/uno/unotxdoc.cxx:3145
 #18 0x00007fd4a24c5ada in doc_paintTile (pThis=0xed2fa10, pBuffer=0x12871f30 "", nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/desktop/source/lib/init.cxx:4431
 #19 0x00007fd4a24c6bb3 in doc_paintPartTile (pThis=0xed2fa10, pBuffer=0x12871f30 "", nPart=0, nMode=0, nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/desktop/source/lib/init.cxx:4629
 #20 0x00000000005f0f0e in lok::Document::paintPartTile (this=0xf521420, pBuffer=0x12871f30 "", nPart=0, nMode=0, nCanvasWidth=1792, nCanvasHeight=768, nTilePosX=0, nTilePosY=113280, nTileWidth=13440, nTileHeight=5760)
     at /home/caolan/LibreOffice/co-24.04/include/LibreOfficeKit/LibreOfficeKit.hxx:621
 #21 0x00000000005c2627 in RenderTiles::doRender(std::shared_ptr<lok::Document> const&, DeltaGenerator&, TileCombined&, ThreadPool&, std::function<void (unsigned char*, int, int, unsigned long, unsigned long, int, int, LibreOfficeKitTileMode)> const&, std::function<void (char const*, unsigned long)> const&, unsigned int, int, bool) (document=..., deltaGen=..., tileCombined=..., pngPool=..., blendWatermark=..., outputMessage=...,
     mobileAppDocId=3, canonicalViewId=1000, dumpTiles=false) at ./common/RenderTiles.hpp:123
 #22 0x00000000005cd29d in Document::renderTiles (this=0xe6eefc0, tileCombined=...) at kit/Kit.cpp:933

where otherwise the browser gets no update of the document size.

Change-Id: I396daa9c7ee5c306ee107839f6fba6b26a70683d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173936
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit ed75469)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173907
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 26, 2024
since:

commit f3e1272
CommitDate: Wed May 10 13:28:09 2023 +0200

    use comphelper::WeakComponentImplHelper in DocumentEventNotifier::Impl

problem:

108        std::unique_lock aGuard(m_aMutex);
109        if ( !impl_isDisposed_nothrow(aGuard) )
110        {
111            acquire();
CID 1608414: (#1 of 1): Double lock (LOCK)
4. double_lock: dispose locks this->m_aMutex while it is locked.[show details]
112            dispose();
    /include/comphelper/compbase.hxx
    73    virtual void SAL_CALL dispose() noexcept final override
    74    {
    1. lock: dispose locks this->m_aMutex.[show details]
    75        WeakComponentImplHelperBase::dispose();
        /comphelper/source/misc/compbase.cxx
        20    void SAL_CALL WeakComponentImplHelperBase::dispose()
        21    {
        1.        lock: unique_lock locks this->m_aMutex.
        22        std::unique_lock aGuard(m_aMutex);

Change-Id: Ibd9dc0564adf86c6409794f584a743aecd9d36e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173970
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
tdf-gerrit pushed a commit that referenced this pull request Sep 30, 2024
which means we need to push knowledge
about the locking down into ucbhelper::Result
since the implementation classes there
want to call back into the parent.

and also

CID#1607968:Data race condition (MISSING_LOCK)
CID#1606657:Data race condition (MISSING_LOCK)
CID#1607112:Data race condition (MISSING_LOCK)
CID#1608365:Data race condition (MISSING_LOCK)
CID#1607159:Data race condition (MISSING_LOCK)
CID#1607018:Data race condition (MISSING_LOCK)
CID#1607421:Data race condition (MISSING_LOCK)
CID#1607766:Data race condition (MISSING_LOCK)
CID#1606872:Data race condition (MISSING_LOCK)
CID#1608523:Data race condition (MISSING_LOCK
CID#1607191:Data race condition (MISSING_LOCK)
CID#1608345:Data race condition (MISSING_LOCK)
CID#1608577:(#1 of 1):Data race condition (MISSING_LOCK)
CID#1607210:Data race condition (MISSING_LOCK)
CID#1607132:Data race condition (MISSING_LOCK)
CID#1608256:Data race condition (MISSING_LOCK)
CID#1607482:Data race condition (MISSING_LOCK)
CID#1607935:Data race condition (MISSING_LOCK)
CID#1608070:Data race condition (MISSING_LOCK)
CID#1607901:Data race condition (MISSING_LOCK)
CID#1608013:Data race condition (MISSING_LOCK)
CID#1607506:Data race condition (MISSING_LOCK)
CID#1607526:Data race condition (MISSING_LOCK)
CID#1607044:Data race condition (MISSING_LOCK)
CID#1607708:Data race condition (MISSING_LOCK)
CID#1608041:Data race condition (MISSING_LOCK)
CID#1608207:Data race condition (MISSING_LOCK)
CID#1608028:Data race condition (MISSING_LOCK)
CID#1608168:Data race condition (MISSING_LOCK)
CID#1607561:Data race condition (MISSING_LOCK)

CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)
CID#1607689:Check of thread-shared field evades lock acquisition (LOCK_EVASION)

Change-Id: Ifbe908a4a86ab8c5fa1c4ed3b6f9466508e4900e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174204
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants