From 0eb210933e8cfed9742cb7f901b6880af8645971 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 5 Nov 2021 11:34:41 +0100 Subject: [PATCH] Fix itreem tree offsets of children of chained sub-components Similar to commit 4eb161b83fa9ced0c6f8262846fc6c0e9b422212 this works in C++ by accident but for Rust to compile we need to advance the sub-component state in the tree builder. --- sixtyfps_compiler/generator.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sixtyfps_compiler/generator.rs b/sixtyfps_compiler/generator.rs index 16e9538d3..fecdd107c 100644 --- a/sixtyfps_compiler/generator.rs +++ b/sixtyfps_compiler/generator.rs @@ -221,8 +221,14 @@ pub fn build_item_tree( // detect and chain the children visitation. if children.is_empty() { if let Some(nested_subcomponent) = parent_item.borrow().sub_component() { - visit_children( + let sub_component_state = builder.enter_component( + parent_item, + nested_subcomponent, + children_offset, state, + ); + visit_children( + &sub_component_state, &nested_subcomponent.root_element.borrow().children, &nested_subcomponent, &nested_subcomponent.root_element,