Skip to content

Commit

Permalink
fix: crash on macOS non-programmatic close (#41264)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Feb 9, 2024
1 parent 9655ae7 commit c894645
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shell/browser/native_window_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,14 @@ void ReorderChildWindowAbove(NSWindow* child_window, NSWindow* other_window) {
if ([window_ attachedSheet])
[window_ endSheet:[window_ attachedSheet]];

// window_ could be nil after performClose.
bool should_notify = is_modal() && parent() && IsVisible();

[window_ performClose:nil];

// Closing a sheet doesn't trigger windowShouldClose,
// so we need to manually call it ourselves here.
if (is_modal() && parent() && IsVisible()) {
if (should_notify) {
NotifyWindowCloseButtonClicked();
}
}
Expand Down

0 comments on commit c894645

Please sign in to comment.