summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-09-06 15:26:09 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-09-19 12:10:00 +0200
commited86b56c0e0baf99ca65800eb83de1558f162734 (patch)
tree69ee7054f79759d201e914941b28cd4df297403a /comphelper
parent2f1181629a0a11ecc1c6eb5d6a5f09421b14a7c3 (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> (cherry picked from commit d9e31f3c82082226dbc5afa697d0f0ac7e4214a2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156602 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/accessiblewrapper.cxx25
1 files changed, 19 insertions, 6 deletions
diff --git a/comphelper/source/misc/accessiblewrapper.cxx b/comphelper/source/misc/accessiblewrapper.cxx
index a199d82cc5de..3d7c8574e2c6 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