mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: crash on missing RenderWidgetHostView (#38115)
chore: fix crash on missing RenderWidgetHostView Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -287,12 +287,14 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user