Fix recursion when component with height-for-width items is in a FlexboxLayout#11382
Open
dfaure-kdab wants to merge 2 commits intoslint-ui:masterfrom
Open
Fix recursion when component with height-for-width items is in a FlexboxLayout#11382dfaure-kdab wants to merge 2 commits intoslint-ui:masterfrom
dfaure-kdab wants to merge 2 commits intoslint-ui:masterfrom
Conversation
…ht-for-width children (slint-ui#11381)" This reverts commit edf9800.
…boxLayout When a component containing Text with word-wrap or Image with aspect ratio is placed inside a FlexboxLayout, evaluating the component's vertical layout info would panic with recursion: layoutinfo-v → internal layout → Text/Image reads width → component width → layout cache → layoutinfo-v. For builtins directly in a layout, the VTable cross_axis_constraint parameter breaks this cycle. But for components, layoutinfo-v is a property binding with no parameter mechanism. Fix: add a cross-axis constraint thread-local in i_slint_core::layout. Text and Image items check it when their explicit constraint is -1 (meaning "no constraint passed"). The thread-local is set at two levels: - Compiled path: SolveFlexboxLayout wraps its entire expression (including cells computation) with set_cross_axis_constraint (container_width), so all nested ImplicitLayoutInfo(Vertical, -1) calls inside components see the constraint. - Interpreter path: get_layout_info_with_constraint saves/restores the thread-local at each component boundary, so nested components get the correct constraint for their level.
f2beb23 to
2aa4783
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revert "FlexboxLayout: detect binding loops when components have height-for-width children (#11381)"
This reverts commit edf9800.
Fix recursion when component with height-for-width items is in a FlexboxLayout
When a component containing Text with word-wrap or Image with aspect
ratio is placed inside a FlexboxLayout, evaluating the component's
vertical layout info would panic with recursion: layoutinfo-v →
internal layout → Text/Image reads width → component width → layout
cache → layoutinfo-v.
For builtins directly in a layout, the VTable cross_axis_constraint
parameter breaks this cycle. But for components, layoutinfo-v is a
property binding with no parameter mechanism.
Fix: add a cross-axis constraint thread-local in i_slint_core::layout.
Text and Image items check it when their explicit constraint is -1
(meaning "no constraint passed"). The thread-local is set at two
levels:
Compiled path: SolveFlexboxLayout wraps its entire expression
(including cells computation) with set_cross_axis_constraint
(container_width), so all nested ImplicitLayoutInfo(Vertical, -1)
calls inside components see the constraint.
Interpreter path: get_layout_info_with_constraint saves/restores the
thread-local at each component boundary, so nested components get
the correct constraint for their level.