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
This commit is contained in:
Kohei Yoshida 2016-11-15 21:56:32 -05:00
parent 84f644eee7
commit e4e208fa2b
2 changed files with 13 additions and 1 deletions

View File

@ -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 );

View File

@ -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 );
}