Skip to content

Commit

Permalink
fix: crash on missing RenderWidgetHostView (#38136)
Browse files Browse the repository at this point in the history
fix: crash on missing `RenderWidgetHostView` (#38100)

chore: fix crash on missing RenderWidgetHostView

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
felixrieseberg and codebytere committed May 1, 2023
1 parent 8b7a54d commit 6b2a63f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,14 @@ - (void)redispatchContextMenuEvent:(NSEvent*)event {
// Temporarily pretend that the WebContents is fully non-draggable while we
// re-send the mouse event. This allows the re-dispatched event to "land"
// on the WebContents, instead of "falling through" back to the window.
api_contents->SetForceNonDraggable(true);
BaseView* contentsView = (BaseView*)contents->GetRenderWidgetHostView()
->GetNativeView()
.GetNativeNSView();
[contentsView mouseEvent:event];
api_contents->SetForceNonDraggable(false);
auto* rwhv = contents->GetRenderWidgetHostView();
if (rwhv) {
api_contents->SetForceNonDraggable(true);
BaseView* contentsView =
(BaseView*)rwhv->GetNativeView().GetNativeNSView();
[contentsView mouseEvent:event];
api_contents->SetForceNonDraggable(false);
}
}
}

Expand Down

0 comments on commit 6b2a63f

Please sign in to comment.