summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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