From 03e00d6b71ac40d772084c3714dd4a9e9dd2cbcf Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 18 May 2022 17:29:54 +0100 Subject: [PATCH] ensure position property is consistent before window is open. --- native/Avalonia.Native/src/OSX/WindowBaseImpl.mm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm index 0ab120038b..b84e999825 100644 --- a/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowBaseImpl.mm @@ -364,12 +364,17 @@ HRESULT WindowBaseImpl::GetPosition(AvnPoint *ret) { return E_POINTER; } - auto frame = [Window frame]; + if(Window != nullptr) { + auto frame = [Window frame]; - ret->X = frame.origin.x; - ret->Y = frame.origin.y + frame.size.height; + ret->X = frame.origin.x; + ret->Y = frame.origin.y + frame.size.height; - *ret = ConvertPointY(*ret); + *ret = ConvertPointY(*ret); + } else + { + *ret = lastPositionSet; + } return S_OK; }