From bb006b46e64fd73f1b18ddc4bc60b124109d9746 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 26 Nov 2019 13:26:54 -0500 Subject: [PATCH] Fix potential OSR crash due to uninitialized host_display_client_ (see issue #2811) --- libcef/browser/osr/render_widget_host_view_osr.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 580036182..d989c0a0d 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -162,6 +162,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( : content::RenderWidgetHostViewBase(widget), background_color_(background_color), frame_rate_threshold_us_(0), + host_display_client_(nullptr), hold_resize_(false), pending_resize_(false), pending_resize_force_(false), @@ -814,7 +815,9 @@ CefRenderWidgetHostViewOSR::CreateSyntheticGestureTarget() { void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) { SetFrameRate(); - host_display_client_->SetActive(enabled); + if (host_display_client_) { + host_display_client_->SetActive(enabled); + } } void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() { @@ -1496,7 +1499,7 @@ void CefRenderWidgetHostViewOSR::InvalidateInternal( const gfx::Rect& bounds_in_pixels) { if (video_consumer_) { video_consumer_->SizeChanged(); - } else { + } else if (host_display_client_) { OnPaint(bounds_in_pixels, host_display_client_->GetPixelSize(), host_display_client_->GetPixelMemory()); }