add error log for graphics failure

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2021-12-10 22:36:34 +08:00
parent 29905608b5
commit 4cb967251b

View File

@ -29,6 +29,8 @@ struct UI(
Arc<Mutex<HashMap<String, String>>>,
);
struct UIHostHandler;
fn get_msgbox() -> String {
#[cfg(feature = "inline")]
return inline::get_msgbox();
@ -86,10 +88,12 @@ pub fn start(args: &mut [String]) {
std::thread::spawn(move || check_zombie(cloned));
crate::common::check_software_update();
frame.event_handler(UI::new(childs));
frame.sciter_handler(UIHostHandler {});
page = "index.html";
} else if args[0] == "--install" {
let childs: Childs = Default::default();
frame.event_handler(UI::new(childs));
frame.sciter_handler(UIHostHandler {});
page = "install.html";
} else if args[0] == "--cm" {
frame.register_behavior("connection-manager", move || {
@ -612,6 +616,12 @@ impl sciter::EventHandler for UI {
}
}
impl sciter::host::HostHandler for UIHostHandler {
fn on_graphics_critical_failure(&mut self) {
log::error!("Critical rendering error: e.g. DirectX gfx driver error. Most probably bad gfx drivers.");
}
}
pub fn check_zombie(childs: Childs) {
let mut deads = Vec::new();
loop {