diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-04 19:13:30 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-04 19:13:30 +0000 |
commit | 20df155df45ed12565bd9aca2c64667498ee7424 (patch) | |
tree | 073340cbfb3e7ebe5fc9e33e01702b0a84cd1e54 /chrome/browser/browser.cc | |
parent | 2e404f7c06e6967e4fbbeb5bc276ea5df187619b (diff) | |
download | chromium_src-20df155df45ed12565bd9aca2c64667498ee7424.zip chromium_src-20df155df45ed12565bd9aca2c64667498ee7424.tar.gz chromium_src-20df155df45ed12565bd9aca2c64667498ee7424.tar.bz2 |
Attempt to fix a crash in case the TabContents gets destroyed somehow.
http://crbug.com/6702
Review URL: http://codereview.chromium.org/20032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9155 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 96d088c..23f5a04 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1508,6 +1508,8 @@ void Browser::OpenURLFromTab(TabContents* source, const GURL& url, const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) { + // TODO(beng): Move all this code into a separate helper that has unit tests. + // No code for these yet DCHECK((disposition != NEW_POPUP) && (disposition != SAVE_TO_DISK)); @@ -1568,6 +1570,7 @@ void Browser::OpenURLFromTab(TabContents* source, instance); browser->window()->Show(); } else if ((disposition == CURRENT_TAB) && current_tab) { + // TODO(beng): move this block into the TabStripModelOrderController. if (transition == PageTransition::TYPED || transition == PageTransition::AUTO_BOOKMARK || transition == PageTransition::GENERATED || @@ -1597,10 +1600,15 @@ void Browser::OpenURLFromTab(TabContents* source, tabstrip_model_.ForgetGroup(current_tab); } } - current_tab->controller()->LoadURL(url, referrer, transition); - // The TabContents might have changed as part of the navigation (ex: new - // tab page can become WebContents). - new_contents = current_tab->controller()->active_contents(); + // TODO(beng): remove all this once there are no TabContents types. + // It seems like under some circumstances current_tab can be dust after the + // call to LoadURL (perhaps related to TabContents type switching), so we + // save the NavigationController here. + NavigationController* controller = current_tab->controller(); + controller->LoadURL(url, referrer, transition); + // If the TabContents type has been swapped, we need to point to the current + // active type otherwise there will be weirdness. + new_contents = controller->active_contents(); if (GetStatusBubble()) GetStatusBubble()->Hide(); |