sd/source/ui/view/ViewTabBar.cxx | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit 196f81bfc7feb5036959299827cf3f4535bdc5e7 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Mar 8 08:58:52 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Mar 15 10:04:36 2023 +0000 sd: fix crash in ViewTabBar::dispose() Crashreport signature: program/libsdlo.so sd::ViewTabBar::disposing() sd/source/ui/view/ViewTabBar.cxx:113 (discriminator 1) program/libuno_cppuhelpergcc3.so.3 cppu::WeakComponentImplHelperBase::dispose() cppuhelper/source/implbase.cxx:104 program/libuno_cppuhelpergcc3.so.3 cppu::WeakComponentImplHelperBase::release() cppuhelper/source/implbase.cxx:84 program/libsdlo.so sd::ViewTabBar::ViewTabBar(com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) [clone .cold] include/cppuhelper/compbase.hxx:65 program/libsdlo.so sd::framework::BasicToolBarFactory::createResource(com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> const&) sd/source/ui/framework/factories/BasicToolBarFactory.cxx:129 (discriminator 2) I.e. the ViewTabBar got deleted by a smart pointer before its ctor finished, guard against this. Change-Id: I3d6ccc21167355047e3752316c8d0b9b02470f57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148838 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins (cherry picked from commit a224948ef44eadfb32aee002d5f0e9f10c9e47de) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148859 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 588b55eaee8b..e30796d5b7b2 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -66,6 +66,9 @@ ViewTabBar::ViewTabBar ( mpViewShellBase(nullptr), mnNoteBookWidthPadding(0) { + // Do this manually instead of via uno::Reference, so we don't delete ourselves. + osl_atomic_increment(&m_refCount); + // Tunnel through the controller and use the ViewShellBase to obtain the // view frame. try @@ -100,6 +103,8 @@ ViewTabBar::ViewTabBar ( { mpViewShellBase->SetViewTabBar(this); } + + osl_atomic_decrement(&m_refCount); } ViewTabBar::~ViewTabBar()