Browse Source

End/close AppKit sheets attached on window when we hide it (#17968)

release/11.2.4
Maxwell Katz 1 year ago
committed by Max Katz
parent
commit
5b68f3ef60
  1. 13
      native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

13
native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

@ -143,6 +143,19 @@ HRESULT WindowBaseImpl::Hide() {
@autoreleasepool { @autoreleasepool {
if (Window != nullptr) { 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]; auto frame = [Window frame];
AvnPoint point; AvnPoint point;

Loading…
Cancel
Save