Log instead of showing an alert when exiting due to no GPU
Showing the alert resulted in a panic because tasks dispatched to the app's main GCD queue continue to run even while the alert is displayed.
This commit is contained in:
parent
d9de0261ba
commit
ea82b9353d
1 changed files with 4 additions and 8 deletions
|
@ -13,8 +13,8 @@ use crate::{
|
||||||
use block::ConcreteBlock;
|
use block::ConcreteBlock;
|
||||||
use cocoa::{
|
use cocoa::{
|
||||||
appkit::{
|
appkit::{
|
||||||
CGPoint, NSApplication, NSBackingStoreBuffered, NSModalResponse, NSScreen, NSView,
|
CGPoint, NSApplication, NSBackingStoreBuffered, NSScreen, NSView, NSViewHeightSizable,
|
||||||
NSViewHeightSizable, NSViewWidthSizable, NSWindow, NSWindowButton, NSWindowStyleMask,
|
NSViewWidthSizable, NSWindow, NSWindowButton, NSWindowStyleMask,
|
||||||
},
|
},
|
||||||
base::{id, nil},
|
base::{id, nil},
|
||||||
foundation::{
|
foundation::{
|
||||||
|
@ -327,14 +327,10 @@ impl Window {
|
||||||
native_window.setFrame_display_(screen.visibleFrame(), YES);
|
native_window.setFrame_display_(screen.visibleFrame(), YES);
|
||||||
}
|
}
|
||||||
|
|
||||||
let device = if let Some(device) = metal::Device::system_default() {
|
let device: metal::Device = if let Some(device) = metal::Device::system_default() {
|
||||||
device
|
device
|
||||||
} else {
|
} else {
|
||||||
let alert: id = msg_send![class!(NSAlert), alloc];
|
log::error!("unable to access a compatible graphics device");
|
||||||
let _: () = msg_send![alert, init];
|
|
||||||
let _: () = msg_send![alert, setAlertStyle: 2];
|
|
||||||
let _: () = msg_send![alert, setMessageText: ns_string("Unable to access a compatible graphics device")];
|
|
||||||
let _: NSModalResponse = msg_send![alert, runModal];
|
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue