mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Don't panic in the generated rust ComponentHandle::window()
It can panic if lazily constructing the window adapter. Make sure it is actially not lasily constructed, we don't need lazy constructor when not embedding anyway.
This commit is contained in:
parent
62d9f8b13f
commit
9d1be5209c
1 changed files with 2 additions and 0 deletions
|
@ -291,6 +291,8 @@ fn generate_public_component(
|
|||
#init_bundle_translations
|
||||
inner.globals.get().unwrap().init();
|
||||
#inner_component_id::user_init(sp::VRc::map(inner.clone(), |x| x));
|
||||
// ensure that the window exist as this point so further call to window() don't panic
|
||||
inner.globals.get().unwrap().window_adapter_ref()?;
|
||||
core::result::Result::Ok(Self(inner))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue