Bug 735666 - crash [@ nsIDocument::GetContainer() ], r=tbsaunde
authorAlexander Surkov <surkov.alexander@gmail.com>
Wed, 14 Mar 2012 16:37:50 -0400
changeset 89399 5392a82cabeb18094250d59c926daa7ccd65a844
parent 89398 f6a2ab827253e21298470b07078d3cadf1e8f9ae
child 89400 292f15267c3f7fef6107a9a0cc503090b1033496
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerstbsaunde
bugs735666
milestone14.0a1
Bug 735666 - crash [@ nsIDocument::GetContainer() ], r=tbsaunde
accessible/src/base/NotificationController.cpp
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -112,18 +112,20 @@ NotificationController::Shutdown()
 {
   if (mObservingState != eNotObservingRefresh &&
       mPresShell->RemoveRefreshObserver(this, Flush_Display)) {
     mObservingState = eNotObservingRefresh;
   }
 
   // Shutdown handling child documents.
   PRInt32 childDocCount = mHangingChildDocuments.Length();
-  for (PRInt32 idx = childDocCount - 1; idx >= 0; idx--)
-    mHangingChildDocuments[idx]->Shutdown();
+  for (PRInt32 idx = childDocCount - 1; idx >= 0; idx--) {
+    if (!mHangingChildDocuments[idx]->IsDefunct())
+      mHangingChildDocuments[idx]->Shutdown();
+  }
 
   mHangingChildDocuments.Clear();
 
   mDocument = nsnull;
   mPresShell = nsnull;
 
   mTextHash.Clear();
   mContentInsertions.Clear();
@@ -254,16 +256,18 @@ NotificationController::WillRefresh(mozi
   // Process rendered text change notifications.
   mTextHash.EnumerateEntries(TextEnumerator, mDocument);
   mTextHash.Clear();
 
   // Bind hanging child documents.
   PRUint32 hangingDocCnt = mHangingChildDocuments.Length();
   for (PRUint32 idx = 0; idx < hangingDocCnt; idx++) {
     nsDocAccessible* childDoc = mHangingChildDocuments[idx];
+    if (childDoc->IsDefunct())
+      continue;
 
     nsIContent* ownerContent = mDocument->GetDocumentNode()->
       FindContentForSubDocument(childDoc->GetDocumentNode());
     if (ownerContent) {
       nsAccessible* outerDocAcc = mDocument->GetAccessible(ownerContent);
       if (outerDocAcc && outerDocAcc->AppendChild(childDoc)) {
         if (mDocument->AppendChildDocument(childDoc))
           continue;