Fix DCHECK during Find (issue #2050)

This commit is contained in:
Marshall Greenblatt
2017-05-05 15:34:20 -04:00
parent 86c329e790
commit e5ad5a8fcd
4 changed files with 29 additions and 12 deletions

View File

@ -784,6 +784,14 @@ void CefBrowserHostImpl::Find(int identifier, const CefString& searchText,
if (!web_contents_)
return;
// Every find request must have a unique ID and these IDs must strictly
// increase so that newer requests always have greater IDs than older
// requests.
if (identifier <= find_request_id_counter_)
identifier = ++find_request_id_counter_;
else
find_request_id_counter_ = identifier;
blink::WebFindOptions options;
options.forward = forward;
options.match_case = matchCase;

View File

@ -637,6 +637,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Observers that want to be notified of changes to this object.
base::ObserverList<Observer> observers_;
// Used to provide unique incremental IDs for each find request.
int find_request_id_counter_ = 0;
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
};