Browse Source

[OSX] catch exceptions when window closed and tries to lockFocusIfCanDraw.

pull/3338/head
Dan Walmsley 6 years ago
parent
commit
6383d4f1ea
  1. 11
      native/Avalonia.Native/src/OSX/gl.mm
  2. 9
      native/Avalonia.Native/src/OSX/window.mm

11
native/Avalonia.Native/src/OSX/gl.mm

@ -233,8 +233,17 @@ public:
auto f = GetFeature();
if(f == NULL)
return E_FAIL;
if(![_view lockFocusIfCanDraw])
@try
{
if(![_view lockFocusIfCanDraw])
return E_ABORT;
}
@catch(NSException* exception)
{
return E_ABORT;
}
auto gl = _context;
CGLLockContext([_context CGLContextObj]);

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

@ -291,7 +291,14 @@ public:
{
@autoreleasepool
{
return [View lockFocusIfCanDraw] == YES;
@try
{
return [View lockFocusIfCanDraw] == YES;
}
@catch (NSException*)
{
return NO;
}
}
}

Loading…
Cancel
Save