mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
Fix initialization order of globals
This commit is contained in:
parent
6d48468823
commit
a071738a4a
3 changed files with 53 additions and 4 deletions
|
@ -15,7 +15,7 @@ use std::rc::Rc;
|
|||
|
||||
use crate::api::{Struct, Value};
|
||||
use crate::eval;
|
||||
use sixtyfps_compilerlib::{langtype::Type, object_tree::Component};
|
||||
use sixtyfps_compilerlib::{generator, langtype::Type, object_tree::Component};
|
||||
use sixtyfps_corelib::{rtti, Callback, Property};
|
||||
|
||||
pub trait GlobalComponent {
|
||||
|
@ -85,8 +85,8 @@ impl GlobalComponentInstance {
|
|||
}
|
||||
}
|
||||
let rc = Rc::pin(instance);
|
||||
for (k, expr) in &component.root_element.borrow().bindings {
|
||||
if expr.expression.is_constant() {
|
||||
generator::handle_property_bindings_init(component, |_, k, expr| {
|
||||
if expr.analysis.borrow().as_ref().map_or(false, |a| a.is_const) {
|
||||
rc.properties[k].as_ref().set(eval::eval_expression(
|
||||
&expr.expression,
|
||||
&mut eval::EvalLocalContext::from_global(&(rc.clone() as _)),
|
||||
|
@ -103,7 +103,7 @@ impl GlobalComponentInstance {
|
|||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
rc
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue