Browse Source
Merge pull request #8249 from AvaloniaUI/fixes/osx-crash-on-main-window-close
prevent segfault when closing app with child windows open.
pull/8250/head
Dan Walmsley
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
17 additions and
17 deletions
-
native/Avalonia.Native/src/OSX/WindowImpl.mm
|
|
|
@ -91,11 +91,8 @@ HRESULT WindowImpl::SetParent(IAvnWindow *parent) { |
|
|
|
if(_parent != nullptr) |
|
|
|
{ |
|
|
|
_parent->_children.remove(this); |
|
|
|
auto parent = _parent; |
|
|
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
parent->BringToFront(); |
|
|
|
}); |
|
|
|
_parent->BringToFront(); |
|
|
|
} |
|
|
|
|
|
|
|
auto cparent = dynamic_cast<WindowImpl *>(parent); |
|
|
|
@ -122,20 +119,23 @@ HRESULT WindowImpl::SetParent(IAvnWindow *parent) { |
|
|
|
|
|
|
|
void WindowImpl::BringToFront() |
|
|
|
{ |
|
|
|
if(IsDialog()) |
|
|
|
if(Window != nullptr) |
|
|
|
{ |
|
|
|
Activate(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
[Window orderFront:nullptr]; |
|
|
|
} |
|
|
|
|
|
|
|
[Window invalidateShadow]; |
|
|
|
|
|
|
|
for(auto iterator = _children.begin(); iterator != _children.end(); iterator++) |
|
|
|
{ |
|
|
|
(*iterator)->BringToFront(); |
|
|
|
if(IsDialog()) |
|
|
|
{ |
|
|
|
Activate(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
[Window orderFront:nullptr]; |
|
|
|
} |
|
|
|
|
|
|
|
[Window invalidateShadow]; |
|
|
|
|
|
|
|
for(auto iterator = _children.begin(); iterator != _children.end(); iterator++) |
|
|
|
{ |
|
|
|
(*iterator)->BringToFront(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|