Fix panic when a layout constraint has an Expression::Invalid as binding

We can detect this case earlier

Fix #6590
This commit is contained in:
Olivier Goffart 2024-10-21 11:36:24 +02:00
parent 6c81d5069e
commit 6717e627a1
2 changed files with 12 additions and 1 deletions

View file

@ -406,7 +406,9 @@ fn find_binding<R>(
let mut depth = 0;
loop {
if let Some(b) = element.borrow().bindings.get(name) {
return Some(f(&b.borrow(), &element.borrow().enclosing_component, depth));
if b.borrow().has_binding() {
return Some(f(&b.borrow(), &element.borrow().enclosing_component, depth));
}
}
let e = match &element.borrow().base_type {
ElementType::Component(base) => base.root_element.clone(),

View file

@ -0,0 +1,9 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
component A inherits Window {
// ^warning{Component is implicitly marked for export. This is deprecated and it should be explicitly exported}
preferred-height: x;
// ^error{Unknown unqualified identifier 'x'. Did you mean 'self.x'?}
Image { }
}