Commit fcc4a043 authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Check whether NSWindow ever ran as a sheet.

If a dialog/sheet is constructed and destroyed having never been shown, the normal tear-down sequence never happens. This change ensures that the underlying NSWindow had actually been invoked as a sheet. If not, immediately initiate destruction.

Bug: 1000893
Change-Id: I9a7947db38bd1edcdda64627507fdfc834b127ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869403Reviewed-by: default avatarSidney San Martín <sdy@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707991}
parent e47b748a
...@@ -587,7 +587,7 @@ void NativeWidgetNSWindowBridge::CloseWindow() { ...@@ -587,7 +587,7 @@ void NativeWidgetNSWindowBridge::CloseWindow() {
// it and properly increment the reference count bound to the posted task. // it and properly increment the reference count bound to the posted task.
NSWindow* window = ns_window(); NSWindow* window = ns_window();
if (IsWindowModalSheet()) { if (IsWindowModalSheet() && [ns_window() isSheet]) {
// Sheets can't be closed normally. This starts the sheet closing. Once the // Sheets can't be closed normally. This starts the sheet closing. Once the
// sheet has finished animating, it will call sheetDidEnd: on the parent // sheet has finished animating, it will call sheetDidEnd: on the parent
// window's delegate. Note it still needs to be asynchronous, since code // window's delegate. Note it still needs to be asynchronous, since code
...@@ -602,7 +602,8 @@ void NativeWidgetNSWindowBridge::CloseWindow() { ...@@ -602,7 +602,8 @@ void NativeWidgetNSWindowBridge::CloseWindow() {
} }
// For other modal types, animate the close. // For other modal types, animate the close.
if (ShouldRunCustomAnimationFor(VisibilityTransition::kHide)) { if (ShouldRunCustomAnimationFor(VisibilityTransition::kHide) &&
[ns_window() isVisible]) {
[ViewsNSWindowCloseAnimator closeWindowWithAnimation:window]; [ViewsNSWindowCloseAnimator closeWindowWithAnimation:window];
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment