summaryrefslogtreecommitdiffstats
path: root/chrome/browser/accessibility
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-03 18:03:52 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-03 18:03:52 +0000
commit9b346de8ed2301957661a9ec5a21206f8fab965c (patch)
tree88c6ad3f56b71028e2ab31037a6238fb4678d57f /chrome/browser/accessibility
parent3ab9cb81731759c6e11f8c5296c1b75a7d2dadf1 (diff)
downloadchromium_src-9b346de8ed2301957661a9ec5a21206f8fab965c.zip
chromium_src-9b346de8ed2301957661a9ec5a21206f8fab965c.tar.gz
chromium_src-9b346de8ed2301957661a9ec5a21206f8fab965c.tar.bz2
Don't resuse a BrowserAccessibility when our assumption, that is has already been detacted from the tree, doesn't hold.
An investigation as to why our assumption isn't holding needs to take place but this will help prevent BrowserAccessibility tree curruption that leads to crashes in the browser. BUG=84016 TEST=none Review URL: http://codereview.chromium.org/7066042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/accessibility')
-rw-r--r--chrome/browser/accessibility/browser_accessibility_manager.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_manager.cc b/chrome/browser/accessibility/browser_accessibility_manager.cc
index c52d0a2..4c58228 100644
--- a/chrome/browser/accessibility/browser_accessibility_manager.cc
+++ b/chrome/browser/accessibility/browser_accessibility_manager.cc
@@ -339,13 +339,15 @@ BrowserAccessibility* BrowserAccessibilityManager::CreateAccessibilityTree(
if (instance && instance->role() != src.role)
instance = NULL;
- if (instance) {
- // If we're reusing a node, it should already be detached from a parent
- // and any children. If not, that means we have a serious bug somewhere,
- // like the same child is reachable from two places in the same tree.
- DCHECK_EQ(static_cast<BrowserAccessibility*>(NULL), instance->parent());
- DCHECK_EQ(0U, instance->child_count());
+ // If we're reusing a node, it should already be detached from a parent
+ // and any children. If not, that means we have a serious bug somewhere,
+ // like the same child is reachable from two places in the same tree.
+ if (instance && (instance->parent() != NULL || instance->child_count() > 0)) {
+ NOTREACHED();
+ instance = NULL;
+ }
+ if (instance) {
// If we're reusing a node, update its parent and increment its
// reference count.
instance->UpdateParent(parent, index_in_parent);