Commit 89a2cd44 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fix assertion failure in RWHVA destruction

Assertion at RenderWidgetHostViewAndroid::StopObservingRootWindow
called via |Destroy| failed, since WebContentsViewAndroid::SetContentViewCore
was passing a valid ViewAndroid instead of nullptr when cvc is destroyed.
This kept RWHVA observing root window, while the view tree was already
torn down by WCVA dtor, leaving RWHVA in inconsistent state where it
couldn't get WindowAndroid any more. This CL fixes the bug. Previously
WCVA passed null CVC to RWHVA before https://crrev.com/c/958646, so
this fix is the correct behavior.

Bug: 828211
Change-Id: I79463cd0dce94c5f8d81417208cd313871c4f5d7
Reviewed-on: https://chromium-review.googlesource.com/991002Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548308}
parent 3bf3dd65
...@@ -117,7 +117,7 @@ void WebContentsViewAndroid::SetContentViewCore(ContentViewCore* cvc) { ...@@ -117,7 +117,7 @@ void WebContentsViewAndroid::SetContentViewCore(ContentViewCore* cvc) {
content_view_core_.reset(cvc); content_view_core_.reset(cvc);
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
if (rwhv) if (rwhv)
rwhv->UpdateNativeViewTree(&view_); rwhv->UpdateNativeViewTree(cvc ? &view_ : nullptr);
if (web_contents_->ShowingInterstitialPage()) { if (web_contents_->ShowingInterstitialPage()) {
rwhv = static_cast<RenderWidgetHostViewAndroid*>( rwhv = static_cast<RenderWidgetHostViewAndroid*>(
...@@ -127,7 +127,7 @@ void WebContentsViewAndroid::SetContentViewCore(ContentViewCore* cvc) { ...@@ -127,7 +127,7 @@ void WebContentsViewAndroid::SetContentViewCore(ContentViewCore* cvc) {
->GetWidget() ->GetWidget()
->GetView()); ->GetView());
if (rwhv) if (rwhv)
rwhv->UpdateNativeViewTree(&view_); rwhv->UpdateNativeViewTree(cvc ? &view_ : nullptr);
} }
} }
......
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