diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-09-06 15:26:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-09-06 20:24:16 +0200 |
commit | d9e31f3c82082226dbc5afa697d0f0ac7e4214a2 (patch) | |
tree | 6765946c6688da36627206ed62fc76d2cadd805f /comphelper | |
parent | 268a2009bc8acd9412183b4cd9bb7023b31e4f0b (diff) |
tdf#156683 a11y: Handle both disposing variants in context wrapper
commit db0044242a897e447988169630ff74e4c8bfecf9
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Wed Sep 6 09:12:23 2023 +0200
tdf#156683 a11y: Forward when wrapped a11y context is disposing
switched from overriding `disposing()` to overriding
`disposing(const css::lang::EventObject&)` in
`OAccessibleContextWrapperHelper` in order to
make 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.
As Noel points out in [1], the `disposing()`
case should probably still be overriden/handled
and make sure that the wrapped object etc. get
disposed, so disposing one object via the other
works both ways.
(If the wrapped object is disposed, so is the
wrapper. If the wrapper gets disposed, so is
the wrapped object.)
Therefore, add back `OAccessibleContextWrapper::disposing()`
and extract the logic to a separate helper method
that is called from both `disposing` variants.
[1] https://gerrit.libreoffice.org/c/core/+/156592/comments/bb7c24bc_94033649
Change-Id: If15fd1839b222ad94fcbc569842dc43b517d3574
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156620
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/accessiblewrapper.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/comphelper/source/misc/accessiblewrapper.cxx b/comphelper/source/misc/accessiblewrapper.cxx index bd66b7534d46..3e356f434faa 100644 --- a/comphelper/source/misc/accessiblewrapper.cxx +++ b/comphelper/source/misc/accessiblewrapper.cxx @@ -585,12 +585,8 @@ namespace comphelper } - void SAL_CALL OAccessibleContextWrapper::disposing(const css::lang::EventObject& rEvent) + void OAccessibleContextWrapper::implDisposing(const css::lang::EventObject* pEvent) { - assert(rEvent.Source == Reference<XInterface>(m_xInnerContext, UNO_QUERY) - && "OAccessibleContextWrapper::disposing called with event source that's not the " - "wrapped a11y context"); - AccessibleEventNotifier::TClientId nClientId( 0 ); // --- <mutex lock> ----------------------------------------- @@ -607,12 +603,29 @@ namespace comphelper // --- </mutex lock> ----------------------------------------- // let the base class do - OAccessibleContextWrapperHelper::disposing(rEvent); + if (pEvent) + OAccessibleContextWrapperHelper::disposing(*pEvent); + else + OAccessibleContextWrapperHelper::dispose(); // notify the disposal if ( nClientId ) AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, *this ); } + + void SAL_CALL OAccessibleContextWrapper::disposing() + { + implDisposing(nullptr); + } + + void SAL_CALL OAccessibleContextWrapper::disposing(const css::lang::EventObject& rEvent) + { + assert(rEvent.Source == Reference<XInterface>(m_xInnerContext, UNO_QUERY) + && "OAccessibleContextWrapper::disposing called with event source that's not the " + "wrapped a11y context"); + + implDisposing(&rEvent); + } } // namespace accessibility |