From 4051732d27f9bba0d85d71c8cfb0049dce2fd906 Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Thu, 17 Mar 2011 19:55:00 +0000 Subject: 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 --- chrome/browser/instant/instant_controller.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'chrome/browser/instant/instant_controller.cc') 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 owned_loader( - loader_manager_->ReleaseLoader(loader)); + // |loader| wasn't pending, yet it may still be the displayed loader. UpdateDisplayableLoader(); } } -- cgit v1.1