summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-05 20:39:32 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-05 20:39:32 +0000
commitad25f5ea6b42cf343bc287a38028de6cb24bb145 (patch)
tree72351704842b386e2efe9bf72a23e58d717c5e4a /chrome/views
parent684c1f74077980938850f7b4d96b9a9b3541ee46 (diff)
downloadchromium_src-ad25f5ea6b42cf343bc287a38028de6cb24bb145.zip
chromium_src-ad25f5ea6b42cf343bc287a38028de6cb24bb145.tar.gz
chromium_src-ad25f5ea6b42cf343bc287a38028de6cb24bb145.tar.bz2
Fixes crash that occurred because DialogClientView::AcceptWindow was
getting invoked twice. It appears that because we hide the window then destroy the window after a delay, it is possible for messages to get dispatched after the hide. Dispatching messages after the window was closed made it possible for two enters to be dispatched, which triggered a crash. I've modified the FocusManager to only dispatch key messages if the window is visible. BUG=1361863 TEST=See bug, but also make sure there are no weird focus traversal/accelerator issues in our dialogs. Review URL: http://codereview.chromium.org/251 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/dialog_client_view.cc5
-rw-r--r--chrome/views/focus_manager.cc10
2 files changed, 15 insertions, 0 deletions
diff --git a/chrome/views/dialog_client_view.cc b/chrome/views/dialog_client_view.cc
index 1876d8d..6855a7c 100644
--- a/chrome/views/dialog_client_view.cc
+++ b/chrome/views/dialog_client_view.cc
@@ -165,6 +165,11 @@ void DialogClientView::UpdateDialogButtons() {
}
void DialogClientView::AcceptWindow() {
+ if (accepted_) {
+ // We should only get into AcceptWindow once.
+ NOTREACHED();
+ return;
+ }
accepted_ = true;
if (GetDialogDelegate()->Accept(false))
window()->Close();
diff --git a/chrome/views/focus_manager.cc b/chrome/views/focus_manager.cc
index a79b03a..8b47faf 100644
--- a/chrome/views/focus_manager.cc
+++ b/chrome/views/focus_manager.cc
@@ -301,6 +301,16 @@ bool FocusManager::OnNCDestroy(HWND window) {
bool FocusManager::OnKeyDown(HWND window, UINT message, WPARAM wparam,
LPARAM lparam) {
DCHECK((message == WM_KEYDOWN) || (message == WM_SYSKEYDOWN));
+
+ if (!IsWindowVisible(root_)) {
+ // We got a message for a hidden window. Because HWNDViewContainer::Close
+ // hides the window, then destroys it, it it possible to get a message after
+ // we've hidden the window. If we allow the message to be dispatched
+ // chances are we'll crash in some weird place. By returning false we make
+ // sure the message isn't dispatched.
+ return false;
+ }
+
// First give the registered keystoke handlers a chance a processing
// the message
// Do some basic checking to try to catch evil listeners that change the list