Bug 1264852 - destroy an event tree as it gets processed, r=n.nethercote
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 28 Apr 2016 13:12:46 -0400
changeset 357643 13d3afcb47e455fde5e5c094a31ad540964bdd40
parent 357642 d0b927c11679673ddfe774b816c64b8f2aee6117
child 357644 769357ba097f91607d48c9ee75fd5069e4c07963
push id16816
push userbmo:gasolin@mozilla.com
push dateFri, 29 Apr 2016 03:33:20 +0000
reviewersn.nethercote
bugs1264852
milestone49.0a1
Bug 1264852 - destroy an event tree as it gets processed, r=n.nethercote
accessible/base/EventTree.cpp
accessible/base/NotificationController.cpp
--- a/accessible/base/EventTree.cpp
+++ b/accessible/base/EventTree.cpp
@@ -178,23 +178,22 @@ TreeMutation::Done()
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // EventTree
 
 void
 EventTree::Process()
 {
-  EventTree* node = mFirst;
-  while (node) {
+  while (mFirst) {
     // Skip a node and its subtree if its container is not in the document.
-    if (node->mContainer->IsInDocument()) {
-      node->Process();
+    if (mFirst->mContainer->IsInDocument()) {
+      mFirst->Process();
     }
-    node = node->mNext;
+    mFirst = mFirst->mNext.forget();
   }
 
   MOZ_ASSERT(mContainer || mDependentEvents.IsEmpty(),
              "No container, no events");
   MOZ_ASSERT(!mContainer || !mContainer->IsDefunct(),
              "Processing events for defunct container");
 
   // Fire mutation events.
--- a/accessible/base/NotificationController.cpp
+++ b/accessible/base/NotificationController.cpp
@@ -397,17 +397,16 @@ NotificationController::WillRefresh(mozi
   mRelocations.Clear();
 
   // If a generic notification occurs after this point then we may be allowed to
   // process it synchronously.  However we do not want to reenter if fireing
   // events causes script to run.
   mObservingState = eRefreshProcessing;
 
   mEventTree.Process();
-  mEventTree.Clear();
 
   ProcessEventQueue();
 
   if (IPCAccessibilityActive()) {
     size_t newDocCount = newChildDocs.Length();
     for (size_t i = 0; i < newDocCount; i++) {
       DocAccessible* childDoc = newChildDocs[i];
       Accessible* parent = childDoc->Parent();