diff options
author | klink@chromium.org <klink@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-11 03:30:04 +0000 |
---|---|---|
committer | klink@chromium.org <klink@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-11 03:30:04 +0000 |
commit | b1fc294270003c25ffebf7d3cf4381b93cf91c40 (patch) | |
tree | 5d1e8dd8f2074f9e2b73e37f56af773cfed7e389 /chrome/browser/browser_accessibility_manager.cc | |
parent | 974adca61971317a0ed16f4ea3e570059ae7145c (diff) | |
download | chromium_src-b1fc294270003c25ffebf7d3cf4381b93cf91c40.zip chromium_src-b1fc294270003c25ffebf7d3cf4381b93cf91c40.tar.gz chromium_src-b1fc294270003c25ffebf7d3cf4381b93cf91c40.tar.bz2 |
Fixes a null pointer bug, and adds null checks around potentially dying process and channel.
Review URL: http://codereview.chromium.org/7099
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3268 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_accessibility_manager.cc')
-rw-r--r-- | chrome/browser/browser_accessibility_manager.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/chrome/browser/browser_accessibility_manager.cc b/chrome/browser/browser_accessibility_manager.cc index f2755c0..51b7654 100644 --- a/chrome/browser/browser_accessibility_manager.cc +++ b/chrome/browser/browser_accessibility_manager.cc @@ -103,10 +103,14 @@ bool BrowserAccessibilityManager::RequestAccessibilityInfo( new ViewMsg_GetAccessibilityInfo( members->render_widget_host_->routing_id(), in_params, &out_params_); - // Necessary for the send to keep the UI responsive. - msg->EnableMessagePumping(); - bool success = members->render_widget_host_->process()->channel()-> - SendWithTimeout(msg, kAccessibilityMessageTimeOut); + bool success = false; + if (members->render_widget_host_->process() && + members->render_widget_host_->process()->channel()) { + // Necessary for the send to keep the UI responsive. + msg->EnableMessagePumping(); + success = members->render_widget_host_->process()->channel()-> + SendWithTimeout(msg, kAccessibilityMessageTimeOut); + } return success; } @@ -157,11 +161,13 @@ void BrowserAccessibilityManager::Observe(NotificationType type, // Set BrowserAccessibility instance to inactive state. it->second->set_instance_active(false); - render_process_host_map_.erase(it); // Delete entry also from InstanceMap. InstanceMap::iterator it2 = instance_map_.find(it->second->instance_id()); if (it2 != instance_map_.end()) instance_map_.erase(it2); + + // Only delete the first entry once it is no longer in use. + render_process_host_map_.erase(it); } |