mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 18:29:09 +00:00
Rust generator: don't run the init code twice for popups (#6447)
Don't run the `init=>` callback in popup twice ChangeLog: rust: Fixed `init=>` callback on PopupWindow ran twice.
This commit is contained in:
parent
054035d930
commit
04e03ed197
2 changed files with 6 additions and 20 deletions
|
@ -1442,20 +1442,6 @@ fn generate_item_tree(
|
|||
quote!(sp::Rc::new(SharedGlobals::new(sp::VRc::downgrade(&self_dyn_rc))))
|
||||
};
|
||||
|
||||
let new_end = if let Some(parent_ctx) = parent_ctx {
|
||||
if parent_ctx.repeater_index.is_some() {
|
||||
// Repeaters run their user_init() code from RepeatedItemTree::init() after update() initialized model_data/index.
|
||||
quote!(core::result::Result::Ok(self_rc))
|
||||
} else {
|
||||
quote! {
|
||||
Self::user_init(sp::VRc::map(self_rc.clone(), |x| x));
|
||||
core::result::Result::Ok(self_rc)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
quote!(core::result::Result::Ok(self_rc))
|
||||
};
|
||||
|
||||
let embedding_function = if parent_ctx.is_some() {
|
||||
quote!(todo!("Components written in Rust can not get embedded yet."))
|
||||
} else {
|
||||
|
@ -1546,7 +1532,7 @@ fn generate_item_tree(
|
|||
let globals = #globals;
|
||||
sp::register_item_tree(&self_dyn_rc, globals.maybe_window_adapter_impl());
|
||||
Self::init(sp::VRc::map(self_rc.clone(), |x| x), globals, 0, 1);
|
||||
#new_end
|
||||
core::result::Result::Ok(self_rc)
|
||||
}
|
||||
|
||||
fn item_tree() -> &'static [sp::ItemTreeNode] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue