summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-06 23:10:37 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-06 23:10:37 +0000
commita91ba0e491757bddf03e8032f9f3f18954b7ac38 (patch)
treed89f81919478675ebc63775ac88df50dbfc0dd41 /chrome
parent5856887365d0b2a48ed2c5d160b50904959edb59 (diff)
downloadchromium_src-a91ba0e491757bddf03e8032f9f3f18954b7ac38.zip
chromium_src-a91ba0e491757bddf03e8032f9f3f18954b7ac38.tar.gz
chromium_src-a91ba0e491757bddf03e8032f9f3f18954b7ac38.tar.bz2
Fix a couple of (likely rare) crashers that can happen if a tab is closed right as it's about to display a JS modal dialog.
I don't know how these would be triggered in the field. I ran into them through misuse of the current API (trying to pass in a NULL WebContents). Review URL: http://codereview.chromium.org/62079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13203 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/app_modal_dialog_queue.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/app_modal_dialog_queue.cc b/chrome/browser/app_modal_dialog_queue.cc
index 6646bbc..c3888bd 100644
--- a/chrome/browser/app_modal_dialog_queue.cc
+++ b/chrome/browser/app_modal_dialog_queue.cc
@@ -19,7 +19,10 @@ void AppModalDialogQueue::AddDialog(views::AppModalDialogDelegate* dialog) {
ShowModalDialog(dialog);
}
- app_modal_dialog_queue_->push(dialog);
+ // ShowModalDialog can wind up calling ShowNextDialog in some cases, which
+ // can then make app_modal_dialog_queue_ NULL.
+ if (app_modal_dialog_queue_)
+ app_modal_dialog_queue_->push(dialog);
}
// static
@@ -43,6 +46,9 @@ void AppModalDialogQueue::ActivateModalDialog() {
// static
void AppModalDialogQueue::ShowModalDialog(
views::AppModalDialogDelegate* dialog) {
- dialog->ShowModalDialog();
+ // ShowModalDialog can wind up calling ShowNextDialog in some cases,
+ // which will wind up calling this method recursively, so active_dialog_
+ // must be set first.
active_dialog_ = dialog;
+ dialog->ShowModalDialog();
}