fix: do not call close on sheets themselves (#22410)
This commit is contained in:
parent
ed33a72c23
commit
2c974915a3
2 changed files with 53 additions and 7 deletions
|
@ -588,7 +588,14 @@ void NativeWindowMac::SetContentView(views::View* view) {
|
|||
void NativeWindowMac::Close() {
|
||||
// When this is a sheet showing, performClose won't work.
|
||||
if (is_modal() && parent() && IsVisible()) {
|
||||
[parent()->GetNativeWindow().GetNativeNSWindow() endSheet:window_];
|
||||
NSWindow* window = parent()->GetNativeWindow().GetNativeNSWindow();
|
||||
if (NSWindow* sheetParent = [window sheetParent]) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::BindOnce(base::RetainBlock(^{
|
||||
[sheetParent endSheet:window];
|
||||
})));
|
||||
}
|
||||
|
||||
// Manually emit close event (not triggered from close fn)
|
||||
NotifyWindowCloseButtonClicked();
|
||||
CloseImmediately();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue