Fix crash in RemoveFrame on unknown frame_tree_node_id (fixes issue #2799)

This commit is contained in:
Marshall Greenblatt 2019-11-06 13:17:18 -05:00
parent cc6f285abd
commit 58e17b3cdc
1 changed files with 9 additions and 5 deletions

View File

@ -164,14 +164,18 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
// A new RFH with the same node ID may be added before the old RFH is deleted, // A new RFH with the same node ID may be added before the old RFH is deleted,
// or this might be a speculative RFH. Therefore only delete the map entry if // or this might be a speculative RFH. Therefore only delete the map entry if
// it's currently pointing to the to-be-deleted frame info object. // it's currently pointing to the to-be-deleted frame info object.
if (frame_tree_node_id_map_.find(frame_info->frame_tree_node_id_)->second == {
frame_info) { auto it2 = frame_tree_node_id_map_.find(frame_info->frame_tree_node_id_);
frame_tree_node_id_map_.erase(frame_info->frame_tree_node_id_); if (it2 != frame_tree_node_id_map_.end() && it2->second == frame_info) {
frame_tree_node_id_map_.erase(frame_info->frame_tree_node_id_);
}
} }
// And finally delete the frame info. // And finally delete the frame info.
auto it2 = frame_info_set_.find(frame_info); {
frame_info_set_.erase(it2); auto it2 = frame_info_set_.find(frame_info);
frame_info_set_.erase(it2);
}
} }
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() { CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetMainFrame() {