Bug 1473192 - Recycle virtual content node when reassigning. r=jchen
authorEitan Isaacson <eitan@monotonous.org>
Tue, 03 Jul 2018 18:02:00 +0300
changeset 814666 1ad5e959f5944956689259c7cac1455f59a9cfdf
parent 814665 071479680af90941f570e2aa798d6ed2d5479eee
child 814667 626eb82739e7be8e09e130db28fa1c17f7d5340e
push id115307
push userbmo:ntim.bugs@gmail.com
push dateThu, 05 Jul 2018 21:47:40 +0000
reviewersjchen
bugs1473192
milestone63.0a1
Bug 1473192 - Recycle virtual content node when reassigning. r=jchen
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
@@ -425,16 +425,19 @@ public class SessionAccessibility {
         }
 
         if (eventSource != View.NO_ID &&
                 (eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED ||
                  eventType == AccessibilityEvent.TYPE_VIEW_FOCUSED ||
                  eventType == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER)) {
             // In Jelly Bean we populate an AccessibilityNodeInfo with the minimal amount of data to have
             // it work with TalkBack.
+            if (mVirtualContentNode != null) {
+                mVirtualContentNode.recycle();
+            }
             mVirtualContentNode = AccessibilityNodeInfo.obtain(mView, eventSource);
             populateNodeInfoFromJSON(mVirtualContentNode, message);
         }
 
         final AccessibilityEvent accessibilityEvent = obtainEvent(eventType, eventSource);
         populateEventFromJSON(accessibilityEvent, message);
         ((ViewParent) mView).requestSendAccessibilityEvent(mView, accessibilityEvent);
     }