Skip to content

Commit

Permalink
Fix a crash in WebLocalFrameImpl::ShowDeferredContextMenu
Browse files Browse the repository at this point in the history
This CL fixes the crash that happens when the local frame
is detached before the object of WebLocalFrameImpl is
GC'ed.

Bug: 1176545
Change-Id: Id90072da1b235b62132f2a295398467aaaf2db9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2695007
Reviewed-by: Kentaro Hara <[email protected]>
Commit-Queue: Gyuyoung Kim <[email protected]>
Cr-Commit-Position: refs/heads/master@{#853938}
  • Loading branch information
Gyuyoung authored and Chromium LUCI CQ committed Feb 15, 2021
1 parent d929f2a commit bde8181
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions third_party/blink/renderer/core/frame/web_local_frame_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,10 @@ void WebLocalFrameImpl::ShowContextMenu(
void WebLocalFrameImpl::ShowDeferredContextMenu(
mojo::PendingAssociatedRemote<mojom::blink::ContextMenuClient> client,
const UntrustworthyContextMenuParams& params) {
// The local frame may become detached before the object is GC'ed. So, this
// method needs to check if GetFrame() returns a nullptr.
if (!GetFrame())
return;
GetFrame()->GetLocalFrameHostRemote().ShowContextMenu(std::move(client),
params);
}
Expand Down

0 comments on commit bde8181

Please sign in to comment.