summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-27 20:55:12 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-27 20:55:12 +0000
commit1e5e74f9c310a95bdac3923811d665cf88ebcd45 (patch)
tree85f23d19f15e55094ae6066c87a1a3eb074e7086 /chrome/browser
parent2fb5fbc0798b2969389212f39ee7a8ed7333bb97 (diff)
downloadchromium_src-1e5e74f9c310a95bdac3923811d665cf88ebcd45.zip
chromium_src-1e5e74f9c310a95bdac3923811d665cf88ebcd45.tar.gz
chromium_src-1e5e74f9c310a95bdac3923811d665cf88ebcd45.tar.bz2
Some ui tests would crash when the browser was closed.
The problem was related to an infobar (the default browser one) showing. When the tab is closed, InfoBarClosed is called on the infobar delegates, triggering a delete of the delegate. Then a notification that the tab is destroyed is sent, causing the tab contents to layout its infobars accessing the deleted delegates. BUG=12668 TEST=All UI tests should pass (especially the LoginPromptTest ones). Make IE your default browser, start Chrome. The default browser infobar should show. Close the tab. Review URL: http://codereview.chromium.org/113906 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index a8eb3ed..1c6f892 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -314,21 +314,25 @@ TabContents::~TabContents() {
window->CloseConstrainedWindow();
}
+ // Notify any observer that have a reference on this tab contents.
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(this),
+ NotificationService::NoDetails());
+
// Notify any lasting InfobarDelegates that have not yet been removed that
// whatever infobar they were handling in this TabContents has closed,
// because the TabContents is going away entirely.
+ // This must happen after the TAB_CONTENTS_DESTROYED notification as the
+ // notification may trigger infobars calls that access their delegate. (and
+ // some implementations of InfoBarDelegate do delete themselves on
+ // InfoBarClosed()).
for (int i = 0; i < infobar_delegate_count(); ++i) {
InfoBarDelegate* delegate = GetInfoBarDelegateAt(i);
delegate->InfoBarClosed();
}
infobar_delegates_.clear();
- // Notify any observer that have a reference on this tab contents.
- NotificationService::current()->Notify(
- NotificationType::TAB_CONTENTS_DESTROYED,
- Source<TabContents>(this),
- NotificationService::NoDetails());
-
// TODO(brettw) this should be moved to the view.
#if defined(OS_WIN)
// If we still have a window handle, destroy it. GetNativeView can return