diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-03-08 08:58:52 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-03-09 20:07:37 +0000 |
commit | 769b8517b6ce237ccb34dd11dc7151de72849699 (patch) | |
tree | caf583480aed8f42788fbcc4ba454dce9efe94ac | |
parent | ea09fa25a7a47e43d1a9ee5e489c921c0278db51 (diff) |
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/+/148459
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | sd/source/ui/view/ViewTabBar.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index fd8c83f8841c..19722039877b 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() |