diff options
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 16 |
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 |