Bug 1264852 - destroy an event tree as it gets processed, r=n.nethercote a=lizzard
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 28 Apr 2016 13:12:46 -0400
changeset 332751 f00dc61ce26fffce4060cf86cfde7b28491c68f8
parent 332750 b059ea150b9ed99780e615da1c7242017d8fa5cf
child 332752 eb1e2a6b09e39b8f348507863599362691694a08
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersn, lizzard
bugs1264852
milestone48.0a2
Bug 1264852 - destroy an event tree as it gets processed, r=n.nethercote a=lizzard
accessible/base/EventTree.cpp
accessible/base/NotificationController.cpp
--- a/accessible/base/EventTree.cpp
+++ b/accessible/base/EventTree.cpp
@@ -179,23 +179,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();