Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 09a522d1bf3291e57d8ae6d9fb2f7e7d74746c0f..f8fc455e8ac57cd6f12cfb9b30ab3ff56b118982 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -3201,6 +3201,15 @@ void Browser::TabInsertedAt(TabContentsWrapper* contents, |
void Browser::TabClosingAt(TabStripModel* tab_strip_model, |
TabContentsWrapper* contents, |
int index) { |
+ if (fullscreened_tab_ == contents) { |
+ ExitTabbedFullscreenModeIfNecessary(); |
+ // The call to exit fullscreen may result in asynchronous notification of |
+ // fullscreen state change (e.g., on Linux). We don't want to rely on it |
+ // to call NotifyTabOfFullscreenExitIfNecessary(), because at that point |
+ // |fullscreen_tab_| may not be valid. Instead, we call it here to clean up |
+ // tab fullscreen related state. |
+ NotifyTabOfFullscreenExitIfNecessary(); |
+ } |
content::NotificationService::current()->Notify( |
content::NOTIFICATION_TAB_CLOSING, |
content::Source<NavigationController>(&contents->controller()), |