From a91ba0e491757bddf03e8032f9f3f18954b7ac38 Mon Sep 17 00:00:00 2001 From: "erikkay@google.com" Date: Mon, 6 Apr 2009 23:10:37 +0000 Subject: 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 --- chrome/browser/app_modal_dialog_queue.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'chrome') 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(); } -- cgit v1.1