fix: crash when calling BrowserWindow.moveTop() on modal children (#39499)

fix: crash when calling moveTop() on modal children
This commit is contained in:
Shelley Vohr 2023-08-16 13:28:29 +02:00 committed by GitHub
parent f7a7085019
commit 1eb398b328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -812,7 +812,7 @@ bool NativeWindowMac::MoveAbove(const std::string& sourceId) {
if (!webrtc::GetWindowOwnerPid(window_id))
return false;
if (!parent()) {
if (!parent() || is_modal()) {
[window_ orderWindow:NSWindowAbove relativeTo:window_id];
} else {
NSWindow* other_window = [NSApp windowWithWindowNumber:window_id];
@ -823,10 +823,11 @@ bool NativeWindowMac::MoveAbove(const std::string& sourceId) {
}
void NativeWindowMac::MoveTop() {
if (!parent())
if (!parent() || is_modal()) {
[window_ orderWindow:NSWindowAbove relativeTo:0];
else
} else {
ReorderChildWindowAbove(window_, nullptr);
}
}
void NativeWindowMac::SetResizable(bool resizable) {