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

Recursion not detected #3525

Closed EdorianDark closed 1 year ago

EdorianDark commented 1 year ago

While testing in https://slint.dev/releases/1.2.1/editor I noticed, that the following leads to continously growing window.

import { Button, HorizontalBox, TextEdit } from "std-widgets.slint";
export component Demo {
    HorizontalBox {
        alignment: start;
        Text {
            text: "Format JSON";
            font-size: 24px;
            horizontal-alignment: center;
        }
        TextEdit {
        font-size: 14px;
        width: parent.width;
        height: parent.height;
        text: "Lorem ipsum dolor sit amet,\n consectetur adipisici elit";
    }
        HorizontalLayout { alignment: center; Button { text: "OK!"; } }
    }
}

I would have expected, that there is an error or warning in this case.

ogoffart commented 1 year ago

Thanks for the bug report. This is actually a known problem which is tracked in https://github.com/slint-ui/slint/issues/2902 We should indeed find a way to make it an error, but that's not trivial to detect unfortunately. Closing as a duplicate of #2902