diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-11-21 22:56:46 -0500 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2016-11-22 13:18:00 +0000 |
commit | 87e040fd0f04307534920d0765af6d5878794a98 (patch) | |
tree | 8faa3f12d311d9c1fc205d9c333e2b15da934894 | |
parent | a0ef7474521413c8967559a635e6fdc0d88f1df6 (diff) |
tdf#71409: Stop listening to objects going out-of-focus.
This helps eliminate the number of AtkListener objects growing
over time.
Change-Id: I5cfeac8beae8e950382116544da99ad9c1c1a254
Reviewed-on: https://gerrit.libreoffice.org/31062
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
-rw-r--r-- | vcl/unx/gtk/a11y/atklistener.cxx | 20 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atklistener.hxx | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx index 5cc6083fc288..39930b274fda 100644 --- a/vcl/unx/gtk/a11y/atklistener.cxx +++ b/vcl/unx/gtk/a11y/atklistener.cxx @@ -121,6 +121,9 @@ void AtkListener::updateChildList( css::uno::Reference<css::accessibility::XAccessibleContext> const & pContext) { + if (!pContext.is()) + return; + m_aChildList.clear(); uno::Reference< accessibility::XAccessibleStateSet > xStateSet = pContext->getAccessibleStateSet(); @@ -255,6 +258,19 @@ void AtkListener::handleInvalidateChildren( } } +void AtkListener::stopListening() +{ + uno::Reference<accessibility::XAccessibleEventBroadcaster> xBroadcaster( + mpWrapper->mpContext.get(), uno::UNO_QUERY); + + if (xBroadcaster.is()) + { + uno::Reference<accessibility::XAccessibleEventListener> xListener(this); + if (xListener.is()) + xBroadcaster->removeAccessibleEventListener(xListener); + } +} + /*****************************************************************************/ static uno::Reference< accessibility::XAccessibleContext > @@ -346,6 +362,10 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven gboolean bState = eNewState != ATK_STATE_INVALID; AtkStateType eRealState = bState ? eNewState : eOldState; + if (eOldState == ATK_STATE_FOCUSED) + // Stop listening to object going out-of-focus. + stopListening(); + atk_object_notify_state_change( atk_obj, eRealState, bState ); break; } diff --git a/vcl/unx/gtk/a11y/atklistener.hxx b/vcl/unx/gtk/a11y/atklistener.hxx index 39dbe5db9446..fccf03181c37 100644 --- a/vcl/unx/gtk/a11y/atklistener.hxx +++ b/vcl/unx/gtk/a11y/atklistener.hxx @@ -66,6 +66,8 @@ private: // Process INVALIDATE_ALL_CHILDREN notification void handleInvalidateChildren( const css::uno::Reference< css::accessibility::XAccessibleContext >& rxParent); + + void stopListening(); }; #endif // INCLUDED_VCL_UNX_GTK_A11Y_ATKLISTENER_HXX |