summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 01:17:35 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 01:17:35 +0000
commit66711f6f7abbf3ed9f0d39e4f497620ab39e79f0 (patch)
treee341e531b756e3dc290fd04d94c30a4da59b25b1 /chrome
parent8516471942ded5ca17efd0681f1ae12ac86f3617 (diff)
downloadchromium_src-66711f6f7abbf3ed9f0d39e4f497620ab39e79f0.zip
chromium_src-66711f6f7abbf3ed9f0d39e4f497620ab39e79f0.tar.gz
chromium_src-66711f6f7abbf3ed9f0d39e4f497620ab39e79f0.tar.bz2
Fix a crash when we try to close a js dialog that wasn't shown.
The dialog has been queued, but it hasn't been shown because a different dialog is already showing. We try to close the dialog because a page navigation has occurred. BUG=47056 TEST=None Review URL: http://codereview.chromium.org/2803017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/app_modal_dialog_gtk.cc4
-rw-r--r--chrome/browser/app_modal_dialog_win.cc2
-rw-r--r--chrome/browser/js_modal_dialog.cc7
3 files changed, 11 insertions, 2 deletions
diff --git a/chrome/browser/app_modal_dialog_gtk.cc b/chrome/browser/app_modal_dialog_gtk.cc
index b0268e6..2eb9185 100644
--- a/chrome/browser/app_modal_dialog_gtk.cc
+++ b/chrome/browser/app_modal_dialog_gtk.cc
@@ -31,17 +31,21 @@ void AppModalDialog::OnDialogResponse(GtkDialog* dialog, gint response_id,
}
void AppModalDialog::ActivateModalDialog() {
+ DCHECK(dialog_);
gtk_window_present(GTK_WINDOW(dialog_));
}
void AppModalDialog::CloseModalDialog() {
+ DCHECK(dialog_);
HandleDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT);
}
void AppModalDialog::AcceptWindow() {
+ DCHECK(dialog_);
HandleDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_OK);
}
void AppModalDialog::CancelWindow() {
+ DCHECK(dialog_);
HandleDialogResponse(GTK_DIALOG(dialog_), GTK_RESPONSE_CANCEL);
}
diff --git a/chrome/browser/app_modal_dialog_win.cc b/chrome/browser/app_modal_dialog_win.cc
index c892881..e48d986 100644
--- a/chrome/browser/app_modal_dialog_win.cc
+++ b/chrome/browser/app_modal_dialog_win.cc
@@ -19,9 +19,11 @@ void AppModalDialog::CreateAndShowDialog() {
}
void AppModalDialog::ActivateModalDialog() {
+ DCHECK(dialog_);
dialog_->ActivateModalDialog();
}
void AppModalDialog::CloseModalDialog() {
+ DCHECK(dialog_);
dialog_->CloseModalDialog();
}
diff --git a/chrome/browser/js_modal_dialog.cc b/chrome/browser/js_modal_dialog.cc
index 37253b9..111aa01 100644
--- a/chrome/browser/js_modal_dialog.cc
+++ b/chrome/browser/js_modal_dialog.cc
@@ -29,6 +29,9 @@ JavaScriptAppModalDialog::JavaScriptAppModalDialog(
bool is_before_unload_dialog,
IPC::Message* reply_msg)
: AppModalDialog(client->AsTabContents(), title),
+#if defined(OS_MACOSX)
+ dialog_(NULL),
+#endif
client_(client),
extension_host_(client->AsExtensionHost()),
dialog_flags_(dialog_flags),
@@ -64,7 +67,8 @@ void JavaScriptAppModalDialog::Observe(NotificationType type,
// Also clear the client, since it's now invalid.
skip_this_dialog_ = true;
client_ = NULL;
- CloseModalDialog();
+ if (dialog_)
+ CloseModalDialog();
}
void JavaScriptAppModalDialog::InitNotifications() {
@@ -136,4 +140,3 @@ void JavaScriptAppModalDialog::Cleanup() {
}
AppModalDialog::Cleanup();
}
-