From 01f385a6f79da07e97bd13e7852d30f69573d7ba Mon Sep 17 00:00:00 2001 From: Andrei Kurushin Date: Thu, 2 Apr 2020 21:01:33 +0000 Subject: [PATCH] Fix CefFrame::GetSource crash on detached frame (fixes issue #2898) --- libcef/browser/frame_host_impl.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libcef/browser/frame_host_impl.cc b/libcef/browser/frame_host_impl.cc index bae40ec80..7b2f6056f 100644 --- a/libcef/browser/frame_host_impl.cc +++ b/libcef/browser/frame_host_impl.cc @@ -367,6 +367,11 @@ void CefFrameHostImpl::SendCommand( if (frame_id < CefFrameHostImpl::kMainFrameId) return; + if (!render_frame_host_ || !response_manager_) { + // detached frame has no response_manager_ + return; + } + TRACE_EVENT2("cef", "CefFrameHostImpl::SendCommand", "frame_id", frame_id, "needsResponse", responseHandler.get() ? 1 : 0); Cef_Request_Params params; @@ -407,6 +412,11 @@ void CefFrameHostImpl::SendCode( if (frame_id < CefFrameHostImpl::kMainFrameId) return; + if (!render_frame_host_ || !response_manager_) { + // detached frame has no response_manager_ + return; + } + TRACE_EVENT2("cef", "CefFrameHostImpl::SendCommand", "frame_id", frame_id, "needsResponse", responseHandler.get() ? 1 : 0); Cef_Request_Params params;