summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-09-06 09:12:23 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-09-19 12:09:42 +0200
commit2f1181629a0a11ecc1c6eb5d6a5f09421b14a7c3 (patch)
tree5adecf3332c8b3965b7d852284fcf1e9ad8cccb9 /include
parent9cecc2927bdffcb6235a9d0baf649e14c6c7beb2 (diff)
tdf#156683 a11y: Forward when wrapped a11y context is disposing
`OAccessibleContextWrapper` wraps an `XAccessibleContext` held in the `m_xInnerContext` member and forwards calls to its own methods to that one. The lifecycle of the wrapper should match that of the wrapped context, so handle when the wrapped context is disposing by overriding `XAccessibleContext::disposing` (that takes a `css::lang::EventObject&` parameter) instead of overriding `WeakComponentImplHelperBase::disposing` (the `disposing` method not taking a param) that's meant to be called when/right before the object itself gets disposed (but wasn't called at all e.g. for the `OToolBoxWindowItemContext` case in tdf#156683). This makes sure that the corresponding entry in the `AccessibleEventNotifier` client map is removed and event listeners for the wrapper get notified (via `AccessibleEventNotifier::revokeClientNotifyDisposing`) when the wrapped object is disposing and fixes the tdf#156683 crash on exit with gtk3 observed in the libreoffice-7-6 branch: /usr/include/c++/13/debug/vector:450: In function: std::debug::vector<_Tp, _Allocator>::const_reference std:: debug::vector<_Tp, _Allocator>::operator[](size_type) const [with _Tp = com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>; _Allocator = std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> >; const_reference = const com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>&; size_type = long unsigned int] Error: attempt to subscript container with out-of-bounds index 0, but container only holds 0 elements. Objects involved in the operation: sequence "this" @ 0x561465d8e510 { type = std::debug::vector<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>, std::allocator<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> > >; } warn:desktop:197113:197113:desktop/source/app/crashreport.cxx:61: minidump generated: /home/michi/development/git/libreoffice-WORKTREE/instdir/program/../program/../crash//e338ad13-2338-4cd0-8d5c069d-c28f5cf5.dmp Backtrace: 1 comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener>::disposeAndClear interfacecontainer4.hxx 397 0x7f2c39915cdc 2 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing accessibleeventnotifier.cxx 204 0x7f2c39913c75 3 comphelper::OAccessibleContextWrapper::disposing accessiblewrapper.cxx 610 0x7f2c3992f033 4 cppu::WeakComponentImplHelperBase::dispose implbase.cxx 104 0x7f2c3947491b 5 cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext>::dispose compbase.hxx 90 0x7f2bf8b31c70 6 cppu::WeakComponentImplHelperBase::release implbase.cxx 79 0x7f2c39474664 7 cppu::PartialWeakComponentImplHelper<com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext>::release compbase.hxx 86 0x7f2c3993133c 8 comphelper::OAccessibleContextWrapper::release accessiblewrapper.cxx 475 0x7f2c3992e536 9 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::clear Reference.hxx 231 0x7f2c26929685 10 atk_object_wrapper_dispose atkwrapper.cxx 1074 0x7f2c26928a2e 11 atk_object_wrapper_finalize atkwrapper.cxx 670 0x7f2c26927677 12 g_object_unref 0x7f2c3418c48c 13 AtkListener::~AtkListener atklistener.cxx 57 0x7f2c26900547 14 AtkListener::~AtkListener atklistener.cxx 58 0x7f2c2690057e 15 cppu::OWeakObject::release weak.cxx 230 0x7f2c39556056 16 cppu::WeakImplHelper<com::sun::star::accessibility::XAccessibleEventListener>::release implbase.hxx 115 0x7f2c2690a92e 17 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>::~Reference Reference.hxx 114 0x7f2c39921b9f 18 std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener>> stl_construct.h 151 0x7f2c399217af 19 std::_Destroy_aux<false>::__destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> *> stl_construct.h 163 0x7f2c39920bd5 20 std::_Destroy<com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEventListener> *> stl_construct.h 196 0x7f2c3991f10b ... <More> Reverse-debugging to the start of `atk_object_wrapper_dispose` (s. frame 10 above), shows that the the `mpContext` is`: uno::Reference to ((anonymous namespace)::OToolBoxWindowItemContext *) 0x5637df79f1b8 Also, call the base class implementation of the same method, i.e. `OAccessibleContextWrapperHelper::disposing` instead of directly disposing via `OAccessibleContextWrapperHelper::dispose`. The former will call `dispose` via its base class implementation if it hasn't been disposed yet, s. `OComponentProxyAggregationHelper::disposing`. Change-Id: Ief66ffbe075af40f10c5fafa62063bda55f66b2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156610 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> (cherry picked from commit d3acb84c23e8894a51459c4faa6907b0d030fc17) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156592 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/accessiblewrapper.hxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/comphelper/accessiblewrapper.hxx b/include/comphelper/accessiblewrapper.hxx
index 8a09ae0110c3..c2ababe40e1a 100644
--- a/include/comphelper/accessiblewrapper.hxx
+++ b/include/comphelper/accessiblewrapper.hxx
@@ -298,8 +298,10 @@ namespace comphelper
virtual void notifyTranslatedEvent( const css::accessibility::AccessibleEventObject& _rEvent ) override;
// OComponentHelper
- using OAccessibleContextWrapperHelper::disposing;
- virtual void SAL_CALL disposing() override;
+ using cppu::WeakComponentImplHelperBase::disposing;
+
+ // XAccessibleEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override;
protected:
virtual ~OAccessibleContextWrapper() override;