From 484931bba2e93cc166e0fbae5d99f78e149fe97a Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 16 Apr 2021 17:42:09 +0200 Subject: [PATCH] fix: end attached sheet when calling window.hide() (#28671) --- shell/browser/native_window_mac.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 87311853eb..02e59420a8 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -537,6 +537,12 @@ void NativeWindowMac::ShowInactive() { } void NativeWindowMac::Hide() { + // If a sheet is attached to the window when we call [window_ orderOut:nil], + // the sheet won't be able to show again on the same window. + // Ensure it's closed before calling [window_ orderOut:nil]. + if ([window_ attachedSheet]) + [window_ endSheet:[window_ attachedSheet]]; + if (is_modal() && parent()) { [window_ orderOut:nil]; [parent()->GetNativeWindow().GetNativeNSWindow() endSheet:window_];