summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-23 22:59:06 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-23 22:59:06 +0000
commit6e2f2cec2c56d8e8e7f268ef3facc295d98a4b36 (patch)
tree7978cd83627140e3cf63fa62214863fcff4abb0b /chrome
parent020f5bad1085d21d6ad912241ae3669ef1a9375f (diff)
downloadchromium_src-6e2f2cec2c56d8e8e7f268ef3facc295d98a4b36.zip
chromium_src-6e2f2cec2c56d8e8e7f268ef3facc295d98a4b36.tar.gz
chromium_src-6e2f2cec2c56d8e8e7f268ef3facc295d98a4b36.tar.bz2
A crasher happens when restoring the focus as a result of switching tab, because the browser window does not have a focus manager.
I am not sure how this could happen, this CL just bullet-proofs the code. BUG=1384044 Review URL: http://codereview.chromium.org/4054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2529 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/tab_contents.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents.cc b/chrome/browser/tab_contents.cc
index e80431c..a0d39f3 100644
--- a/chrome/browser/tab_contents.cc
+++ b/chrome/browser/tab_contents.cc
@@ -446,7 +446,11 @@ void TabContents::RestoreFocus() {
} else {
ChromeViews::FocusManager* focus_manager =
ChromeViews::FocusManager::GetFocusManager(GetContainerHWND());
- if (focus_manager->ContainsView(last_focused_view)) {
+
+ // If you hit this DCHECK, please report it to Jay (jcampan).
+ DCHECK(focus_manager != NULL) << "No focus manager when restoring focus.";
+
+ if (focus_manager && focus_manager->ContainsView(last_focused_view)) {
last_focused_view->RequestFocus();
} else {
// The focused view may not belong to the same window hierarchy (for