fix: crash on macOS non-programmatic close (#41264)
This commit is contained in:
parent
9655ae7d6a
commit
c894645ac6
1 changed files with 4 additions and 1 deletions
|
@ -439,11 +439,14 @@ void NativeWindowMac::Close() {
|
||||||
if ([window_ attachedSheet])
|
if ([window_ attachedSheet])
|
||||||
[window_ endSheet:[window_ attachedSheet]];
|
[window_ endSheet:[window_ attachedSheet]];
|
||||||
|
|
||||||
|
// window_ could be nil after performClose.
|
||||||
|
bool should_notify = is_modal() && parent() && IsVisible();
|
||||||
|
|
||||||
[window_ performClose:nil];
|
[window_ performClose:nil];
|
||||||
|
|
||||||
// Closing a sheet doesn't trigger windowShouldClose,
|
// Closing a sheet doesn't trigger windowShouldClose,
|
||||||
// so we need to manually call it ourselves here.
|
// so we need to manually call it ourselves here.
|
||||||
if (is_modal() && parent() && IsVisible()) {
|
if (should_notify) {
|
||||||
NotifyWindowCloseButtonClicked();
|
NotifyWindowCloseButtonClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue