Skip to content

Commit

Permalink
End/close AppKit sheets attached on window when we hide it (#17968)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkatz6 authored Jan 15, 2025
1 parent 06ab709 commit 6f27eec
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@

@autoreleasepool {
if (Window != nullptr) {

// If window is hidden without ending attached sheet first, it will stuck in "order out" state,
// and block any new sheets from being attached.
// Additionaly, we don't know if user would define any custom panels, so we only end/close file dialog sheets.
auto attachedSheet = Window.attachedSheet;
if (attachedSheet
&& ([attachedSheet isKindOfClass: [NSOpenPanel class]]
|| [attachedSheet isKindOfClass: [NSSavePanel class]]))
{
[Window endSheet:attachedSheet];
[attachedSheet close];
}

auto frame = [Window frame];

AvnPoint point;
Expand Down

0 comments on commit 6f27eec

Please sign in to comment.