diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-11-15 21:56:32 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-11-15 22:04:49 -0500 |
commit | e4e208fa2b0930be5a7cbbe2fab2ff2fe2c4a1ff (patch) | |
tree | 2f67d85c2f61f3367354e7864863bd5c4e6267a1 | |
parent | 84f644eee78106f01486098d446d9163b62927eb (diff) |
tdf#71409: properly remove itself from the context it listens.
When the context itself is being disposed. While this solves the
issue of addAccessibleEventListener() being called twice despite
removeAccessibleEventListener() being called only once, it won't
solve the problem of leaky atk focus events.
Change-Id: I984107ed2d30e6dba8067d11f400ff64d665d157
-rw-r--r-- | vcl/unx/gtk/a11y/atklistener.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkwrapper.cxx | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx index 9dfa66862b0b..5cc6083fc288 100644 --- a/vcl/unx/gtk/a11y/atklistener.cxx +++ b/vcl/unx/gtk/a11y/atklistener.cxx @@ -196,6 +196,15 @@ void AtkListener::handleChildRemoved( // for now. if( nIndex >= 0 ) { + uno::Reference<accessibility::XAccessibleEventBroadcaster> xBroadcaster( + rxChild->getAccessibleContext(), uno::UNO_QUERY); + + if (xBroadcaster.is()) + { + uno::Reference<accessibility::XAccessibleEventListener> xListener(this); + xBroadcaster->removeAccessibleEventListener(xListener); + } + updateChildList(rxParent); AtkObject * pChild = atk_object_wrapper_ref( rxChild, false ); diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 0d4618ae6c23..52f92186c846 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -846,7 +846,10 @@ atk_object_wrapper_new( const css::uno::Reference< css::accessibility::XAccessib { uno::Reference< accessibility::XAccessibleEventBroadcaster > xBroadcaster(xContext, uno::UNO_QUERY); if( xBroadcaster.is() ) - xBroadcaster->addAccessibleEventListener( static_cast< accessibility::XAccessibleEventListener * > ( new AtkListener(pWrap) ) ); + { + uno::Reference<accessibility::XAccessibleEventListener> xListener(new AtkListener(pWrap)); + xBroadcaster->addAccessibleEventListener(xListener); + } else OSL_ASSERT( false ); } |