summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-03-08 08:58:52 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-03-14 10:14:54 +0000
commita224948ef44eadfb32aee002d5f0e9f10c9e47de (patch)
tree5ef683896a2d6576fa3ef78486f5ec5e58c0ef2b /sd
parent67127e9a1340076d0c8f818b41cc6c44ddd575da (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/+/148838 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/view/ViewTabBar.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx
index d612d7560d32..99b78f27c31f 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.
if (mxController)
@@ -92,6 +95,8 @@ ViewTabBar::ViewTabBar (
{
mpViewShellBase->SetViewTabBar(this);
}
+
+ osl_atomic_decrement(&m_refCount);
}
ViewTabBar::~ViewTabBar()