slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.93k stars 568 forks source link

run-time panic when declaring non-sensical layout constraint #257

Closed tronical closed 11 months ago

tronical commented 3 years ago

The following test case is the result of reducing a larger (valid) design where a width was applied to a vertical layout, which in turn is in a horizontal layout, nested in more layouts.

export TestCase := Rectangle {
    VerticalLayout {
        HorizontalLayout {
            VerticalLayout {
                width: parent.width;
                Rectangle {}
            }
        }
    }
}

This produces the Recursion detected panic in the property system.

Ideally the compiler should detect this circular dependency.

ogoffart commented 3 years ago

This no longer call a runtime panic.

But if we preview that, there is a loop that makes the window grow endlessly. That's because the compile-time loop detection do not see the fact that the Window's size depends on the Windows's minimum-size and it maximum-size, indirectly through the window manager

ogoffart commented 1 year ago

Actually, this has recently been reported as https://github.com/slint-ui/slint/issues/2902 it has a better description, so i'll close this one as duplicated

ogoffart commented 11 months ago

closing as duplicate of https://github.com/slint-ui/slint/issues/2902