Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread 'main' panicked at 'Constant property being changed ' #1233

Closed
TobiasFella opened this issue May 5, 2022 · 1 comment · Fixed by #1238
Closed

thread 'main' panicked at 'Constant property being changed ' #1233

TobiasFella opened this issue May 5, 2022 · 1 comment · Fixed by #1238
Assignees
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working

Comments

@TobiasFella
Copy link

Hi,
when running the following code, the app crashes instantly:
app.slint: (The exact image doesn't seem to matter, happens for any image as long as it exists)

import { ListView } from "std-widgets.slint";

App := Window {
    preferred-width: 100px;
    preferred-height: 600px;

    ListView {
        for item in [
            {}, {},
        ] : Rectangle {
            drop-shadow-blur: 5px;
            HorizontalLayout {
                Image {
                    source: @image-url("/usr/share/icons/breeze/apps/48/kate.svg");
                }
            }
        }
    }
}

build.rs:

fn main() {
    slint_build::compile("app.slint").unwrap();
}

main.rs:

slint::include_modules!();

fn main() {
    let app = App::new();
    app.run();
}

Cargo.toml:

[package]
name = "test"
version = "0.1.0"
edition = "2021"

[dependencies]
slint = "0.2"

[build-dependencies]
slint-build = "0.2.2"

Backtrace:

❯ cargo run
   Compiling test v0.1.0 (/home/tobias/rei)
    Finished dev [unoptimized + debuginfo] target(s) in 9.80s
     Running `target/debug/test`
thread 'main' panicked at 'Constant property being changed ', /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/properties.rs:614:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: i_slint_core::properties::PropertyHandle::mark_dirty
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/properties.rs:614:13
   3: i_slint_core::properties::Property<T>::set
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/properties.rs:824:13
   4: <test::slint_generatedApp::InnerComponent__shadow_5 as i_slint_core::model::RepeatedComponent>::listview_layout
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:663:14
   5: i_slint_core::model::Repeater<C>::compute_layout_listview
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/model.rs:1060:17
   6: i_slint_core::model::Repeater<C>::ensure_updated_listview::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/model.rs:919:31
   7: i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-hkt-0.1.2/src/lib.rs:264:25
   8: i_slint_core::properties::PropertyTracker<ChangeHandler>::evaluate_as_dependency_root
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/properties.rs:2159:17
   9: i_slint_core::properties::PropertyTracker<ChangeHandler>::evaluate_if_dirty::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/properties.rs:2168:33
  10: core::bool::<impl bool>::then
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/bool.rs:43:24
  11: i_slint_core::properties::PropertyTracker<ChangeHandler>::evaluate_if_dirty
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/properties.rs:2168:9
  12: i_slint_core::model::Repeater<C>::ensure_updated_listview
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/model.rs:853:32
  13: test::slint_generatedApp::InnerApp::visit_dynamic_children
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:245:22
  14: <test::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item::visit_dynamic
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:732:18
  15: core::ops::function::Fn::call
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:70:5
  16: i_slint_core::item_tree::visit_item_tree::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:738:21
  17: i_slint_core::item_tree::visit_item_tree
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:757:45
  18: <test::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:730:21
  19: test::slint_generatedApp::InnerApp::item_array::VT::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  20: i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  21: i_slint_core::item_rendering::render_item_children
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:146:5
  22: i_slint_core::item_rendering::render_item_children::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:140:17
  23: i_slint_core::item_tree::<impl i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitor for T>::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:614:9
  24: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  25: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  26: i_slint_core::item_tree::visit_item_tree::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:734:17
  27: i_slint_core::item_tree::visit_item_tree
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:757:45
  28: <test::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:730:21
  29: test::slint_generatedApp::InnerApp::item_array::VT::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  30: i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  31: i_slint_core::item_rendering::render_item_children
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:146:5
  32: i_slint_core::item_rendering::render_item_children::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:140:17
  33: i_slint_core::item_tree::<impl i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitor for T>::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:614:9
  34: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  35: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  36: i_slint_core::item_tree::visit_item_tree::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:734:17
  37: i_slint_core::item_tree::visit_item_tree
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:757:45
  38: <test::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:730:21
  39: test::slint_generatedApp::InnerApp::item_array::VT::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  40: i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  41: i_slint_core::item_rendering::render_item_children
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:146:5
  42: i_slint_core::item_rendering::render_item_children::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:140:17
  43: i_slint_core::item_tree::<impl i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitor for T>::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:614:9
  44: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  45: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  46: i_slint_core::item_tree::visit_item_tree::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:734:17
  47: i_slint_core::item_tree::visit_item_tree
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:757:45
  48: <test::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:730:21
  49: test::slint_generatedApp::InnerApp::item_array::VT::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  50: i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  51: i_slint_core::item_rendering::render_item_children
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:146:5
  52: i_slint_core::item_rendering::render_item_children::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:140:17
  53: i_slint_core::item_tree::<impl i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitor for T>::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:614:9
  54: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  55: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:585:1
  56: i_slint_core::item_tree::visit_item_tree::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:734:17
  57: i_slint_core::item_tree::visit_item_tree
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_tree.rs:748:9
  58: <test::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item
             at ./target/debug/build/test-876d0c9b55bd521e/out/rei.rs:730:21
  59: test::slint_generatedApp::InnerApp::item_array::VT::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  60: i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/component.rs:27:1
  61: i_slint_core::item_rendering::render_item_children
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:146:5
  62: i_slint_core::item_rendering::render_component_items
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/item_rendering.rs:163:5
  63: i_slint_backend_qt::qt_window::QtWindow::paint_event::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-qt-0.2.2/qt_window.rs:1304:17
  64: i_slint_core::window::Window::draw_contents::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/window.rs:515:17
  65: i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-hkt-0.1.2/src/lib.rs:264:25
  66: i_slint_core::properties::PropertyTracker<ChangeHandler>::evaluate_as_dependency_root
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/properties.rs:2159:17
  67: i_slint_core::window::Window::draw_contents
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/window.rs:520:13
  68: i_slint_backend_qt::qt_window::QtWindow::paint_event
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-qt-0.2.2/qt_window.rs:1292:9
  69: i_slint_backend_qt::qt_window::Slint_paintEvent::{{closure}}
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-qt-0.2.2/qt_window.rs:89:17
  70: Slint_paintEvent
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/cpp-0.5.7/src/lib.rs:254:27
  71: _ZN11SlintWidget10paintEventEP11QPaintEvent
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-qt-0.2.2/qt_window.rs:88:139
  72: _ZN7QWidget5eventEP6QEvent
  73: _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent
  74: _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent
  75: _ZN14QWidgetPrivate14sendPaintEventERK7QRegion
  76: _ZN14QWidgetPrivate10drawWidgetEP12QPaintDeviceRK7QRegionRK6QPoint6QFlagsINS_14DrawWidgetFlagEEP8QPainterP21QWidgetRepaintManager
  77: <unknown>
  78: <unknown>
  79: <unknown>
  80: _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent
  81: _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent
  82: _ZN22QGuiApplicationPrivate18processExposeEventEPN29QWindowSystemInterfacePrivate11ExposeEventE
  83: _ZN22QWindowSystemInterface22sendWindowSystemEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE
  84: <unknown>
  85: g_main_dispatch
             at /usr/src/debug/glib2-2.72.0-2.fc36.x86_64/redhat-linux-build/../glib/gmain.c:3417:28
  86: g_main_context_dispatch
             at /usr/src/debug/glib2-2.72.0-2.fc36.x86_64/redhat-linux-build/../glib/gmain.c:4135:7
  87: g_main_context_iterate.constprop.0
             at /usr/src/debug/glib2-2.72.0-2.fc36.x86_64/redhat-linux-build/../glib/gmain.c:4211:5
  88: g_main_context_iteration
             at /usr/src/debug/glib2-2.72.0-2.fc36.x86_64/redhat-linux-build/../glib/gmain.c:4276:12
  89: _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE
  90: _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE
  91: _ZN16QCoreApplication4execEv
  92: __cpp_closure_1553422644876351010
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-qt-0.2.2/lib.rs:164:27
  93: <i_slint_backend_qt::Backend as i_slint_core::backend::Backend>::run_event_loop
             at /home/tobias/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-qt-0.2.2/lib.rs:161:13
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
QPainter::end: Painter ended with 6 saved states
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt.
You must not let any exception whatsoever propagate through Qt code.
@ogoffart ogoffart self-assigned this May 5, 2022
ogoffart added a commit that referenced this issue May 5, 2022
We steal the bindings for the geometry from the containing element,
so we should also take the analysis.

Fixes #1233
@ogoffart
Copy link
Member

ogoffart commented May 5, 2022

Thanks for the bug report.
Fixing with #1238

@ogoffart ogoffart added bug Something isn't working a:compiler Slint compiler internal (not the codegen, not the parser) labels May 5, 2022
ogoffart added a commit that referenced this issue May 5, 2022
We steal the bindings for the geometry from the containing element,
so we should also take the analysis.

Fixes #1233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants