Bug 571541. Make sure to ShutdownDocAccessible even if we have no docshell. r=surkov
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 11 Jun 2010 15:23:13 -0400
changeset 43529 e16ee5d09003c75a03a9f016705f65301ba19d63
parent 43528 574993ec2aeea70d719a79c53f6b2b695021028f
child 43530 36dec4f55fa8d2b33a91ac77f9e082745f0285d5
push id13750
push userbzbarsky@mozilla.com
push dateFri, 11 Jun 2010 19:24:45 +0000
treeherdermozilla-central@e16ee5d09003 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs571541
milestone1.9.3a6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 571541. Make sure to ShutdownDocAccessible even if we have no docshell. r=surkov
accessible/src/base/nsAccDocManager.cpp
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -516,35 +517,35 @@ nsAccDocManager::CreateDocOrRootAccessib
   return docAcc;
 }
 
 void
 nsAccDocManager::ShutdownDocAccessiblesInTree(nsIDocShellTreeItem *aTreeItem,
                                               nsIDocument *aDocument)
 {
   nsCOMPtr<nsIDocShellTreeNode> treeNode(do_QueryInterface(aTreeItem));
-  if (!treeNode)
-    return;
 
-  PRInt32 subDocumentsCount = 0;
-  treeNode->GetChildCount(&subDocumentsCount);
-  for (PRInt32 idx = 0; idx < subDocumentsCount; idx++) {
-    nsCOMPtr<nsIDocShellTreeItem> treeItemChild;
-    treeNode->GetChildAt(idx, getter_AddRefs(treeItemChild));
-    NS_ASSERTION(treeItemChild, "No tree item when there should be");
-    if (!treeItemChild)
-      continue;
+  if (treeNode) {
+    PRInt32 subDocumentsCount = 0;
+    treeNode->GetChildCount(&subDocumentsCount);
+    for (PRInt32 idx = 0; idx < subDocumentsCount; idx++) {
+      nsCOMPtr<nsIDocShellTreeItem> treeItemChild;
+      treeNode->GetChildAt(idx, getter_AddRefs(treeItemChild));
+      NS_ASSERTION(treeItemChild, "No tree item when there should be");
+      if (!treeItemChild)
+        continue;
 
-    nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(treeItemChild));
-    nsCOMPtr<nsIContentViewer> contentViewer;
-    docShell->GetContentViewer(getter_AddRefs(contentViewer));
-    if (!contentViewer)
-      continue;
+      nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(treeItemChild));
+      nsCOMPtr<nsIContentViewer> contentViewer;
+      docShell->GetContentViewer(getter_AddRefs(contentViewer));
+      if (!contentViewer)
+        continue;
 
-    ShutdownDocAccessiblesInTree(treeItemChild, contentViewer->GetDocument());
+      ShutdownDocAccessiblesInTree(treeItemChild, contentViewer->GetDocument());
+    }
   }
 
   ShutdownDocAccessible(aDocument);
 }
 
 void
 nsAccDocManager::ShutdownDocAccessible(nsIDocument *aDocument)
 {