summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autocomplete/autocomplete.h2
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc11
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) {