fix: crash on missing RenderWidgetHostView (#38100)

chore: fix crash on missing RenderWidgetHostView
This commit is contained in:
Shelley Vohr 2023-04-25 11:30:16 +02:00 committed by GitHub
parent a0a1a3645b
commit f4b7e59b2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -287,12 +287,14 @@
// Temporarily pretend that the WebContents is fully non-draggable while we // Temporarily pretend that the WebContents is fully non-draggable while we
// re-send the mouse event. This allows the re-dispatched event to "land" // re-send the mouse event. This allows the re-dispatched event to "land"
// on the WebContents, instead of "falling through" back to the window. // on the WebContents, instead of "falling through" back to the window.
api_contents->SetForceNonDraggable(true); auto* rwhv = contents->GetRenderWidgetHostView();
BaseView* contentsView = (BaseView*)contents->GetRenderWidgetHostView() if (rwhv) {
->GetNativeView() api_contents->SetForceNonDraggable(true);
.GetNativeNSView(); BaseView* contentsView =
[contentsView mouseEvent:event]; (BaseView*)rwhv->GetNativeView().GetNativeNSView();
api_contents->SetForceNonDraggable(false); [contentsView mouseEvent:event];
api_contents->SetForceNonDraggable(false);
}
} }
} }