Browse Source

prevent osx crash when closing inside activate.

repro/outsys-sizing-issue
Dan Walmsley 5 years ago
committed by Steven Kirk
parent
commit
80bb3968e1
  1. 18
      native/Avalonia.Native/src/OSX/window.mm

18
native/Avalonia.Native/src/OSX/window.mm

@ -113,9 +113,11 @@ public:
UpdateStyle();
[Window setContentView: StandardContainer];
[Window setTitle:_lastTitle];
if(ShouldTakeFocusOnShow() && activate)
{
[Window orderFront: Window];
[Window makeKeyAndOrderFront:Window];
[NSApp activateIgnoringOtherApps:YES];
}
@ -123,7 +125,6 @@ public:
{
[Window orderFront: Window];
}
[Window setTitle:_lastTitle];
_shown = true;
@ -180,7 +181,10 @@ public:
{
if (Window != nullptr)
{
[Window close];
auto window = Window;
Window = nullptr;
[window close];
}
return S_OK;
@ -555,6 +559,11 @@ private:
void HideOrShowTrafficLights ()
{
if (Window == nil)
{
return;
}
for (id subview in Window.contentView.superview.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"NSTitlebarContainerView")]) {
NSView *titlebarView = [subview subviews][0];
@ -970,6 +979,11 @@ private:
virtual HRESULT SetWindowState (AvnWindowState state) override
{
if(Window == nullptr)
{
return S_OK;
}
@autoreleasepool
{
if(_actualWindowState == state)

Loading…
Cancel
Save