Commit 60b5d837 authored by paulmeyer's avatar paulmeyer Committed by Commit bot

Fix for crash in GuestViewBase::FindReply.

There are two problems here:

1) The GuestViewBase received a FindReply while its WebContents was in the process of being destroyed. This patch adds a check in WebContentsImpl::NotifyFindReply to prevent this.

2) During destruction of GuestViewBase, there is a period of time when there is no owner WebContents, but attached() still returns true. This patch ensures that that attached() will return false as soon as |owner_web_contents_| is cleared.

BUG=642733

Review-Url: https://codereview.chromium.org/2300663002
Cr-Commit-Position: refs/heads/master@{#415697}
parent 332b4db5
......@@ -478,6 +478,8 @@ void GuestViewBase::Destroy() {
StopTrackingEmbedderZoomLevel();
owner_web_contents_ = nullptr;
element_instance_id_ = kInstanceIDNone;
DCHECK(web_contents());
// Give the derived class an opportunity to perform some cleanup.
......
......@@ -5107,7 +5107,7 @@ void WebContentsImpl::NotifyFindReply(int request_id,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
if (delegate_) {
if (delegate_ && !is_being_destroyed_) {
delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
active_match_ordinal, final_update);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment