Fix potential OSR crash due to uninitialized host_display_client_ (see issue #2811)

This commit is contained in:
Marshall Greenblatt 2019-11-26 13:26:54 -05:00
parent f9706f260a
commit bb006b46e6
1 changed files with 5 additions and 2 deletions

View File

@ -162,6 +162,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
: content::RenderWidgetHostViewBase(widget), : content::RenderWidgetHostViewBase(widget),
background_color_(background_color), background_color_(background_color),
frame_rate_threshold_us_(0), frame_rate_threshold_us_(0),
host_display_client_(nullptr),
hold_resize_(false), hold_resize_(false),
pending_resize_(false), pending_resize_(false),
pending_resize_force_(false), pending_resize_force_(false),
@ -814,8 +815,10 @@ CefRenderWidgetHostViewOSR::CreateSyntheticGestureTarget() {
void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) { void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
SetFrameRate(); SetFrameRate();
if (host_display_client_) {
host_display_client_->SetActive(enabled); host_display_client_->SetActive(enabled);
} }
}
void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() { void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() {
if (GetDelegatedFrameHost()) { if (GetDelegatedFrameHost()) {
@ -1496,7 +1499,7 @@ void CefRenderWidgetHostViewOSR::InvalidateInternal(
const gfx::Rect& bounds_in_pixels) { const gfx::Rect& bounds_in_pixels) {
if (video_consumer_) { if (video_consumer_) {
video_consumer_->SizeChanged(); video_consumer_->SizeChanged();
} else { } else if (host_display_client_) {
OnPaint(bounds_in_pixels, host_display_client_->GetPixelSize(), OnPaint(bounds_in_pixels, host_display_client_->GetPixelSize(),
host_display_client_->GetPixelMemory()); host_display_client_->GetPixelMemory());
} }