summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant/instant_controller.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 19:55:00 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 19:55:00 +0000
commit4051732d27f9bba0d85d71c8cfb0049dce2fd906 (patch)
treeee09dae69fb9fbb40f9b148c44f711ff72244a53 /chrome/browser/instant/instant_controller.cc
parent48f40b2ab482fbf21109fbf396fb43d2285e6f75 (diff)
downloadchromium_src-4051732d27f9bba0d85d71c8cfb0049dce2fd906.zip
chromium_src-4051732d27f9bba0d85d71c8cfb0049dce2fd906.tar.gz
chromium_src-4051732d27f9bba0d85d71c8cfb0049dce2fd906.tar.bz2
Fixes bug in instant where if the search provider didn't support
instant we would destroy the TabContents from a callback from the TabContents, which can cause problems. BUG=76077 TEST=see bug, also covered by test R=jcivelli@chromium.org Review URL: http://codereview.chromium.org/6665058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant/instant_controller.cc')
-rw-r--r--chrome/browser/instant/instant_controller.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 50f833b..c7b7494 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -425,12 +425,15 @@ void InstantController::InstantLoaderDoesntSupportInstant(
// Don't attempt to use instant for this search engine again.
BlacklistFromInstant(loader->template_url_id());
- if (loader_manager_->active_loader() == loader) {
- // The loader is active, hide all.
+ // Because of the state of the stack we can't destroy the loader now.
+ bool was_pending = loader_manager_->pending_loader() == loader;
+ ScheduleDestroy(loader_manager_->ReleaseLoader(loader));
+ if (was_pending) {
+ // |loader| was the pending loader. We may be showing another TabContents to
+ // the user (what was current). Destroy it.
DestroyPreviewContentsAndLeaveActive();
} else {
- scoped_ptr<InstantLoader> owned_loader(
- loader_manager_->ReleaseLoader(loader));
+ // |loader| wasn't pending, yet it may still be the displayed loader.
UpdateDisplayableLoader();
}
}