fix: crash on missing RenderWidgetHostView
(#38100)
chore: fix crash on missing RenderWidgetHostView
This commit is contained in:
parent
a0a1a3645b
commit
f4b7e59b2d
1 changed files with 8 additions and 6 deletions
|
@ -287,13 +287,15 @@
|
||||||
// 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.
|
||||||
|
auto* rwhv = contents->GetRenderWidgetHostView();
|
||||||
|
if (rwhv) {
|
||||||
api_contents->SetForceNonDraggable(true);
|
api_contents->SetForceNonDraggable(true);
|
||||||
BaseView* contentsView = (BaseView*)contents->GetRenderWidgetHostView()
|
BaseView* contentsView =
|
||||||
->GetNativeView()
|
(BaseView*)rwhv->GetNativeView().GetNativeNSView();
|
||||||
.GetNativeNSView();
|
|
||||||
[contentsView mouseEvent:event];
|
[contentsView mouseEvent:event];
|
||||||
api_contents->SetForceNonDraggable(false);
|
api_contents->SetForceNonDraggable(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - NSWindowDelegate
|
#pragma mark - NSWindowDelegate
|
||||||
|
|
Loading…
Reference in a new issue