diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 23:07:35 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 23:07:35 +0000 |
commit | 052212838598dff1ae487e654016da0771b9d975 (patch) | |
tree | 21bbec60dec8c7e316a0e99ea9f387ba2e99075e /chrome/browser/autocomplete/autocomplete_popup_model.cc | |
parent | 3828a755146e0102b934281129fdd6425ca19a0f (diff) | |
download | chromium_src-052212838598dff1ae487e654016da0771b9d975.zip chromium_src-052212838598dff1ae487e654016da0771b9d975.tar.gz chromium_src-052212838598dff1ae487e654016da0771b9d975.tar.bz2 |
Fix crash due to AutocompletePopup trying to draw the old results when they were no longer available.I introduced this regression when moving |result_| to the AutocompleteController; the specific problem was the "result_.CopyFrom(latest_result_);" line I added when handling the synchronous messages being available. This was done so the popup could get at the new results to update the edit with them.Instead, go back to the old method (of not updating the results until the first coalesced update came in), and pass the appropriate result set as a Details<> in the notification, so the popup can get at it without having to know how the controller works under-the-hood.BUG=11742
Review URL: http://codereview.chromium.org/119116
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_popup_model.cc')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_popup_model.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/autocomplete/autocomplete_popup_model.cc index 0186240..0964781 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_model.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_model.cc @@ -250,7 +250,7 @@ void AutocompletePopupModel::Move(int count) { if (IsOpen() && !controller_->done()) { Observe(NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED, Source<AutocompleteController>(controller_.get()), - NotificationService::NoDetails()); + Details<const AutocompleteResult>(&controller_->result())); } const AutocompleteResult& result = controller_->result(); @@ -296,15 +296,16 @@ void AutocompletePopupModel::Observe(NotificationType type, if (inside_synchronous_query_) return; - const AutocompleteResult& result = controller_->result(); + const AutocompleteResult* result = + Details<const AutocompleteResult>(details).ptr(); switch (type.value) { case NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED: { - selected_line_ = (result.default_match() == result.end()) ? - kNoMatch : (result.default_match() - result.begin()); + selected_line_ = (result->default_match() == result->end()) ? + kNoMatch : (result->default_match() - result->begin()); // If we're going to trim the window size to no longer include the hovered // line, turn hover off. Practically, this shouldn't happen, but it // doesn't hurt to be defensive. - if ((hovered_line_ != kNoMatch) && (result.size() <= hovered_line_)) + if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_)) SetHoveredLine(kNoMatch); view_->UpdatePopupAppearance(); @@ -321,8 +322,8 @@ void AutocompletePopupModel::Observe(NotificationType type, std::wstring keyword; bool is_keyword_hint = false; AutocompleteMatch::Type type = AutocompleteMatch::SEARCH_WHAT_YOU_TYPED; - const AutocompleteResult::const_iterator match(result.default_match()); - if (match != result.end()) { + const AutocompleteResult::const_iterator match(result->default_match()); + if (match != result->end()) { if ((match->inline_autocomplete_offset != std::wstring::npos) && (match->inline_autocomplete_offset < match->fill_into_edit.length())) { |