From f963f10acb57526bb4564001dc32c21ebae262f3 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Wed, 19 Nov 2014 00:25:08 +0000 Subject: [PATCH] Hide the DelegatedFrameHost when RenderProcessGone() is called. This avoids a crash due to DelegatedFrameHost calling GetHost() after RenderProcessGone() has been called. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1915 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- libcef/browser/render_widget_host_view_osr.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcef/browser/render_widget_host_view_osr.cc b/libcef/browser/render_widget_host_view_osr.cc index 1c6e63e72..242487e5b 100644 --- a/libcef/browser/render_widget_host_view_osr.cc +++ b/libcef/browser/render_widget_host_view_osr.cc @@ -414,6 +414,7 @@ void CefRenderWidgetHostViewOSR::RenderProcessGone( base::TerminationStatus status, int error_code) { // TODO(OSR): Need to also clear WebContentsViewOSR::view_? + Destroy(); render_widget_host_ = NULL; parent_host_view_ = NULL; popup_host_view_ = NULL; @@ -595,6 +596,7 @@ ui::Layer* CefRenderWidgetHostViewOSR::GetLayer() { } content::RenderWidgetHostImpl* CefRenderWidgetHostViewOSR::GetHost() { + DCHECK(render_widget_host_); return render_widget_host_; } @@ -846,6 +848,9 @@ void CefRenderWidgetHostViewOSR::InternalGenerateFrame() { frame_pending_ = false; frame_start_time_ = base::TimeTicks::Now(); + if (!render_widget_host_) + return; + // The below code is similar in functionality to // DelegatedFrameHost::CopyFromCompositingSurface but we reuse the same // SkBitmap in the GPU codepath and avoid scaling where possible. @@ -863,7 +868,7 @@ void CefRenderWidgetHostViewOSR::InternalGenerateFrame() { void CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceHasResult( scoped_ptr result) { - if (result->IsEmpty() || result->size().IsEmpty()) { + if (result->IsEmpty() || result->size().IsEmpty() || !render_widget_host_) { OnFrameCaptureFailure(); return; }