diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 21:56:18 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 21:56:18 +0000 |
commit | d8265354fd6cdac95be74b3489abb8f55abfcf4b (patch) | |
tree | f31eb810a2b6199ff4f4873a14f145534e897f32 | |
parent | 6e22837d5827ce72b058fd9b89d0939eb26d69b1 (diff) | |
download | chromium_src-d8265354fd6cdac95be74b3489abb8f55abfcf4b.zip chromium_src-d8265354fd6cdac95be74b3489abb8f55abfcf4b.tar.gz chromium_src-d8265354fd6cdac95be74b3489abb8f55abfcf4b.tar.bz2 |
[Mac] Prevent a fullscreen crash by destroying the GTMWindowSheetController in setFullscreen.
BUG=31638
TEST=Trigger a sheet (ex: http auth dialog) after going fullscreen. Should not crash.
Review URL: http://codereview.chromium.org/606029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39141 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.h | 9 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index 4818b52..ca668f2 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -1611,6 +1611,10 @@ willAnimateFromState:(bookmarks::VisualState)oldState fullscreenController_.reset(nil); } + // Destroy the tab strip's sheet controller. We will recreate it in the new + // window when needed. + [tabStripController_ destroySheetController]; + // Retain the tab strip view while we remove it from its superview. scoped_nsobject<NSView> tabStripView; if ([self hasTabStrip]) { diff --git a/chrome/browser/cocoa/tab_strip_controller.h b/chrome/browser/cocoa/tab_strip_controller.h index 1bb6bed..b52f6c4 100644 --- a/chrome/browser/cocoa/tab_strip_controller.h +++ b/chrome/browser/cocoa/tab_strip_controller.h @@ -186,6 +186,15 @@ class ToolbarModel; // for the per-tab sheets. - (GTMWindowSheetController*)sheetController; +// Destroys the window sheet controller of this window, if it exists. The sheet +// controller can be recreated by a subsequent call to |-sheetController|. Must +// not be called if any sheets are currently open. +// TODO(viettrungluu): This is temporary code needed to allow sheets to work +// (read: not crash) in fullscreen mode. Once GTMWindowSheetController is +// modified to support moving sheets between windows, this code can go away. +// http://crbug.com/19093. +- (void)destroySheetController; + // Returns the currently active TabContentsController. - (TabContentsController*)activeTabContentsController; diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index 0a6f7c3..3b0617c 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -1632,6 +1632,12 @@ private: return sheetController_.get(); } +- (void)destroySheetController { + // Make sure there are no open sheets. + DCHECK_EQ(0U, [[sheetController_ viewsWithAttachedSheets] count]); + sheetController_.reset(); +} + - (TabContentsController*)activeTabContentsController { int modelIndex = tabStripModel_->selected_index(); if (modelIndex < 0) |