зеркало из https://github.com/AvaloniaUI/angle.git
Suppress ObjC exceptions in OSXWindow::messageLoop.
Crashes have been seen inside the Cocoa-internal NS_setFlushesWithDisplayLink function. Web searches indicate this is a regression in macOS 11. See whether catching and ignoring these exceptions improves stability. Bug: angleproject:6570 Change-Id: Id0be68077163bf4e9f98189461eea016a35edd73 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3227697 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
This commit is contained in:
Родитель
eb9b3f8eb6
Коммит
4d5711291e
|
@ -712,20 +712,31 @@ void OSXWindow::messageLoop()
|
|||
{
|
||||
while (true)
|
||||
{
|
||||
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
||||
untilDate:[NSDate distantPast]
|
||||
inMode:NSDefaultRunLoopMode
|
||||
dequeue:YES];
|
||||
if (event == nil)
|
||||
// TODO(http://anglebug.com/6570): @try/@catch is a workaround for
|
||||
// exceptions being thrown from Cocoa-internal function
|
||||
// NS_setFlushesWithDisplayLink starting in macOS 11.
|
||||
@try
|
||||
{
|
||||
break;
|
||||
}
|
||||
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
||||
untilDate:[NSDate distantPast]
|
||||
inMode:NSDefaultRunLoopMode
|
||||
dequeue:YES];
|
||||
if (event == nil)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ([event type] == NSAppKitDefined)
|
||||
{
|
||||
continue;
|
||||
if ([event type] == NSAppKitDefined)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
@catch (NSException *localException)
|
||||
{
|
||||
NSLog(@"*** OSXWindow discarding exception: <%@> %@", [localException name],
|
||||
[localException reason]);
|
||||
}
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче