diff --git a/sixtyfps_compiler/layout.rs b/sixtyfps_compiler/layout.rs index 56f0dbc86..8a3c3ad1b 100644 --- a/sixtyfps_compiler/layout.rs +++ b/sixtyfps_compiler/layout.rs @@ -247,6 +247,10 @@ fn init_fake_property( && !grid_layout_element.borrow().bindings.contains_key(name) { if let Some(e) = lazy_default() { + if e.name == name && Rc::ptr_eq(&e.element.upgrade().unwrap(), grid_layout_element) { + // Don't reference self + return; + } grid_layout_element .borrow_mut() .bindings diff --git a/tests/cases/layout/issue_140.60 b/tests/cases/layout/issue_140.60 new file mode 100644 index 000000000..240970a59 --- /dev/null +++ b/tests/cases/layout/issue_140.60 @@ -0,0 +1,36 @@ +/* LICENSE BEGIN + This file is part of the SixtyFPS Project -- https://sixtyfps.io + Copyright (c) 2020 Olivier Goffart + Copyright (c) 2020 Simon Hausmann + + SPDX-License-Identifier: GPL-3.0-only + This file is also available under commercial licensing terms. + Please contact info@sixtyfps.io for more information. +LICENSE END */ + +HelloWorld := Window { + HorizontalLayout { + VerticalLayout { + HorizontalLayout { + height: 50%; + Rectangle {} + } + } + } +} + +/* + +```cpp +auto handle = HelloWorld::create(); +const HelloWorld &instance = *handle; +HelloWorld::apply_layout({&HelloWorld::static_vtable, const_cast(&instance) }, sixtyfps::Rect{0, 0, 300, 300}); +``` + + +```rust +let instance = HelloWorld::new(); +sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.))); +``` + +*/