[Libreoffice-commits] core.git: vcl/unx

Kohei Yoshida kohei.yoshida at collabora.com
Wed Nov 16 05:05:04 UTC 2016


 vcl/unx/gtk/a11y/atklistener.cxx |    9 +++++++++
 vcl/unx/gtk/a11y/atkwrapper.cxx  |    5 ++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit e4e208fa2b0930be5a7cbbe2fab2ff2fe2c4a1ff
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Nov 15 21:56:32 2016 -0500

    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

diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx
index 9dfa668..5cc6083 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 0d4618a..52f9218 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 );
         }


More information about the Libreoffice-commits mailing list