diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 17:27:03 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 17:27:03 +0000 |
commit | 298b4d234ba09d63f9e09345775cb1ff26b2a3e6 (patch) | |
tree | f425946878e61bee6096c9a31d248cf2aceb706a | |
parent | b5ce9e5f0c80448b0582973ea371e9e51d171424 (diff) | |
download | chromium_src-298b4d234ba09d63f9e09345775cb1ff26b2a3e6.zip chromium_src-298b4d234ba09d63f9e09345775cb1ff26b2a3e6.tar.gz chromium_src-298b4d234ba09d63f9e09345775cb1ff26b2a3e6.tar.bz2 |
Unbreak the world. Turns out SetProfile(NULL) causes a DCHECK failure.
TBR=sky
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/177055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25053 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.h | 2 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.cc | 11 |
2 files changed, 3 insertions, 10 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h index 20697b8..d22628b 100644 --- a/chrome/browser/autocomplete/autocomplete.h +++ b/chrome/browser/autocomplete/autocomplete.h @@ -480,6 +480,8 @@ class AutocompleteProvider virtual ~AutocompleteProvider(); // Invoked when the profile changes. + // NOTE: Do not access any previous Profile* at this point as it may have + // already been deleted. void SetProfile(Profile* profile); // Called to start an autocomplete query. The provider is responsible for diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 174f23c..9a23bffe 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -55,17 +55,8 @@ AutocompleteEditModel::AutocompleteEditModel( } AutocompleteEditModel::~AutocompleteEditModel() { - if (--synchronous_controller_refcount == 0) { + if (--synchronous_controller_refcount == 0) delete synchronous_controller; - } else { - // This isn't really necessary, but it ensures safety if someday any - // provider does some kind of cleanup on the old profile when it gets a - // SetProfile() call. The current profile could be deleted after we return, - // so if we don't do this, the providers will be referencing a deleted - // object, and if they accessed it on the next SetProfile() call, bad things - // would happen. - synchronous_controller->SetProfile(NULL); - } } void AutocompleteEditModel::SetPopupModel(AutocompletePopupModel* popup_model) { |