Properly clear pending changes during AXIsolatedTree removal and applyPendingChanges.
authorandresg_22@apple.com <andresg_22@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jan 2020 22:10:05 +0000 (22:10 +0000)
committerandresg_22@apple.com <andresg_22@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Jan 2020 22:10:05 +0000 (22:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=206879

Reviewed by Chris Fleizach.

- After applying pending changes clear the m_pendingAppends and
m_pendingRemovals, so that they are not applied again.
- Also clear these variables when the IsolatedTree is being removed in
the main thread, so that requests in the accessibility thread do not
cause adding changes to a dead tree.

* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::removeTreeForPageID):
(WebCore::AXIsolatedTree::applyPendingChanges):
* accessibility/isolatedtree/AXIsolatedTree.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255311 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h

index 967c0aa..ca001c2 100644 (file)
@@ -1,3 +1,21 @@
+2020-01-28  Andres Gonzalez  <andresg_22@apple.com>
+
+        Properly clear pending changes during AXIsolatedTree removal and applyPendingChanges.
+        https://bugs.webkit.org/show_bug.cgi?id=206879
+
+        Reviewed by Chris Fleizach.
+
+        - After applying pending changes clear the m_pendingAppends and
+        m_pendingRemovals, so that they are not applied again.
+        - Also clear these variables when the IsolatedTree is being removed in
+        the main thread, so that requests in the accessibility thread do not
+        cause adding changes to a dead tree.
+
+        * accessibility/isolatedtree/AXIsolatedTree.cpp:
+        (WebCore::AXIsolatedTree::removeTreeForPageID):
+        (WebCore::AXIsolatedTree::applyPendingChanges):
+        * accessibility/isolatedtree/AXIsolatedTree.h:
+
 2020-01-28  Don Olmstead  <don.olmstead@sony.com>
 
         [LFC][Integration] Build and enable on Windows
index 58e9387..b6fe7d2 100644 (file)
@@ -99,6 +99,8 @@ void AXIsolatedTree::removeTreeForPageID(PageIdentifier pageID)
             if (auto object = tree->nodeForID(axID))
                 object->detach(AccessibilityDetachmentType::CacheDestroyed);
         }
+        tree->m_pendingAppends.clear();
+        tree->m_pendingRemovals.clear();
         tree->m_readerThreadNodeMap.clear();
         treeLocker.unlockEarly();
 
@@ -171,12 +173,14 @@ void AXIsolatedTree::applyPendingChanges()
 
     for (auto& item : m_pendingAppends)
         m_readerThreadNodeMap.add(item->objectID(), WTFMove(item));
+    m_pendingAppends.clear();
 
     for (auto& item : m_pendingRemovals) {
         if (auto object = nodeForID(item))
             object->detach(AccessibilityDetachmentType::ElementDestroyed);
         m_readerThreadNodeMap.remove(item);
     }
+    m_pendingRemovals.clear();
 }
     
 } // namespace WebCore
index 9e2c0a9..69f778b 100644 (file)
@@ -64,7 +64,7 @@ public:
     void setFocusedNodeID(AXID);
     
     // Call on AX thread
-    WEBCORE_EXPORT void applyPendingChanges();
+    void applyPendingChanges();
 
     AXIsolatedTreeID treeIdentifier() const { return m_treeID; }