Rust: Make new(), run() and show() report errors from the backend

Fixes #2198
This commit is contained in:
Olivier Goffart 2023-02-09 15:03:37 +01:00 committed by Olivier Goffart
parent e8ee468cc6
commit 6889dfa5f5
254 changed files with 519 additions and 398 deletions

View file

@ -25,13 +25,13 @@ pub unsafe extern "C" fn slint_windowrc_init(out: *mut WindowAdapterRcOpaque) {
core::mem::size_of::<Rc<dyn WindowAdapter>>(),
core::mem::size_of::<WindowAdapterRcOpaque>()
);
let win = i_slint_backend_selector::with_platform(|b| b.create_window_adapter());
let win = i_slint_backend_selector::with_platform(|b| b.create_window_adapter()).unwrap();
core::ptr::write(out as *mut Rc<dyn WindowAdapter>, win);
}
#[no_mangle]
pub unsafe extern "C" fn slint_run_event_loop() {
i_slint_backend_selector::with_platform(|b| b.run_event_loop());
i_slint_backend_selector::with_platform(|b| b.run_event_loop()).unwrap();
}
/// Will execute the given functor in the main thread