slint-ui / slint

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

Unreachable RuntimeError when inputting content under (wasm) mode #2560

Closed fankaiLiu closed 9 months ago

fankaiLiu commented 1 year ago

I'm encountering an issue where I get an "Uncaught RuntimeError: unreachable" error when inputting content under (wasm) mode, but everything works fine in client mode. Here is the code that's causing the issue:

export global GeneratePageAdapter  { 
  in-out property<string> prompts: "";
  in-out property <string> key_words: "";
  callback generate();
}

export component GeneratePage inherits Page {
  title: "Enter a topic keyword and click the button";
  height: 100%;
  GroupBox {  
    title: "key words";
    vertical-stretch: 0;
    height: 50px;

    LineEdit {
      text<=>GeneratePageAdapter.key_words;
       //text:"1"; it works well
      placeholder-text: "Enter some text";
    }
  }
}

The above code works fine, but when I use text<=>GeneratePageAdapter.key_words; to input content under (wasm) mode, I get the "Uncaught RuntimeError: unreachable" error. Here's the full error message:

Uncaught RuntimeError: unreachable
    at promptpro_bg.wasm:0x232169
    at promptpro_bg.wasm:0x268793
    at promptpro_bg.wasm:0x1bfa07
    at promptpro_bg.wasm:0x190d02
    at promptpro_bg.wasm:0x23ad65
    at promptpro_bg.wasm:0x233bec
    at promptpro_bg.wasm:0x20e9f9
    at promptpro_bg.wasm:0x2499a8
    at promptpro_bg.wasm:0x22b65a
    at promptpro_bg.wasm:0x233bec

I'm not sure what's causing the issue, but it seems to be related to using two-way binding in WebAssembly mode. Any help would be appreciated!

tronical commented 1 year ago

Oops that might be a bug. Perhaps you can get a more detailed backtrace if you build with wasm-pack build --target web --dev.

fankaiLiu commented 1 year ago

Oops that might be a bug. Perhaps you can get a more detailed backtrace if you build with wasm-pack build --target web --dev.

promptpro.js:407 panicked at 'Recursion detected', /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-1.0.0/properties.rs:469:9

Stack:

Error
    at http://localhost:8000/pkg/promptpro.js:413:21
    at logError (http://localhost:8000/pkg/promptpro.js:229:18)
    at imports.wbg.__wbg_new_abda76e883ba8a5f (http://localhost:8000/pkg/promptpro.js:412:66)
    at console_error_panic_hook::Error::new::h47f7926fda3b96ca (http://localhost:8000/pkg/promptpro_bg.wasm:wasm-function[35510]:0xc97266)
    at console_error_panic_hook::hook_impl::he8717ee279933701 (http://localhost:8000/pkg/promptpro_bg.wasm:wasm-function[6900]:0x82cd1b)
    at console_error_panic_hook::hook::h9d87fcb546ba4c3d (http://localhost:8000/pkg/promptpro_bg.wasm:wasm-function[37900]:0xcb8835)
    at core::ops::function::Fn::call::haab3256a5304a1d3 (http://localhost:8000/pkg/promptpro_bg.wasm:wasm-function[34309]:0xc841db)
    at std::panicking::rust_panic_with_hook::hbafe3e603d331223 (http://localhost:8000/pkg/promptpro_bg.wasm:wasm-function[14299]:0xa356bd)
    at std::panicking::begin_panic_handler::{{closure}}::h8ab6ee68d5b4c391 (http://localhost:8000/pkg/promptpro_bg.wasm:wasm-function[18073]:0xae3d15)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h008f69666d134159 (http://localhost:8000/pkg/promptpro_bg.wasm:wasm-function[39925]:0xcd2711)

Thank you for the clarification. The detailed error message is here, and it seems that a recursive call is being made.

      text<=>GeneratePageAdapter.key_words;

I am not sure whether this is caused by my code or an internal issue with Slint.

tronical commented 1 year ago

Good that you managed to identify the recursion. It's strange that the two-way binding triggers it. Do you set anything on the global singleton in Rust code?

fankaiLiu commented 1 year ago

I can think of the usefulness of global singletons before the program runs,

    let app = App::new().unwrap();
    let app_weak = app.as_weak();

    app.global::<GeneratePageAdapter>().on_generate(move || {
        let mj=MidJourney::new();
        let key_words=app_weak
        .unwrap()
        .global::<GeneratePageAdapter>()
        .get_key_words().to_string();
        let mut prompts = String::new();
        for _ in 0..10 {
            prompts.push_str(&mj.generate_prompts(&key_words));
            prompts.push_str("\n");
        }

        app_weak
            .unwrap()
            .global::<GeneratePageAdapter>()
            .set_prompts(prompts.into());
    });
    app.run().unwrap();

and I also use the once_cell library to store global variables. I am not sure if this has any impact, and I hope my expression is clear. My code is located here , and if possible, I would appreciate it if you could take a look.Tanks! :)

Good that you managed to identify the recursion. It's strange that the two-way binding triggers it. Do you set anything on the global singleton in Rust code?

tronical commented 1 year ago

Thanks for sharing the code. Sure, I'll take a look (probably Monday).

tronical commented 1 year ago

I can reproduce this. Oddly only in the wasm build, but not in the regular rust build.

It somehow seems that TextInput::text is queried recursively, but I don't see how that's possible from the backtrace yet:

[Error] panicked at 'Recursion detected', /Users/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-1.0.0/properties.rs:469:9

Stack:

@http://localhost:8000/pkg/promptpro.js:413:30
logError@http://localhost:8000/pkg/promptpro.js:232:23
wasm-stub@[wasm code]
<?>.wasm-function[console_error_panic_hook::Error::new::h182e35e4af0d645e]@[wasm code]
<?>.wasm-function[console_error_panic_hook::hook_impl::hc1a2448a3af8836b]@[wasm code]
<?>.wasm-function[console_error_panic_hook::hook::h66175824eee585e1]@[wasm code]
<?>.wasm-function[core::ops::function::Fn::call::h5dc9eb6b125f9291]@[wasm code]
<?>.wasm-function[std::panicking::rust_panic_with_hook::hc53aea0352e77326]@[wasm code]
<?>.wasm-function[std::panicking::begin_panic_handler::{{closure}}::ha183a8279614f03a]@[wasm code]
<?>.wasm-function[std::sys_common::backtrace::__rust_end_short_backtrace::hc33870f333461503]@[wasm code]
<?>.wasm-function[rust_begin_unwind]@[wasm code]
<?>.wasm-function[core::panicking::panic_fmt::hf4a9df75710ece83]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hcc933590d569ec70]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::hc0cfa7ccfa0df651]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::get::h1594bdce57fa9ded]@[wasm code]
<?>.wasm-function[i_slint_core::items::text::TextInput::text::heeac9325492dd910]@[wasm code]
<?>.wasm-function[<i_slint_core::items::text::TextInput as i_slint_core::items::Item_vtable_mod::Item>::layout_info::hdde72a4ca255ee4d]@[wasm code]
<?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::he7f22189b9347bde]@[wasm code]
<?>.wasm-function[core::ops::function::FnOnce::call_once::h025c2d9aa5ec80c6]@[wasm code]
<?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::hdc9b3921beaab537]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hca51ea1912fdaf77]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::h079d54fc0b6eb8ef]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hf8edf8f291b73fa7]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::h95c78b6e565a7697]@[wasm code]
<?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::hfd41752ee8e7abba]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::ha03975d5d4d6a5e9]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h014181543b6a4bbd]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::access::h3735660768126b25]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h43e7158bab839ace]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::get::h2dd59116d36fd8f3]@[wasm code]
<?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h8b1113656f73c251]@[wasm code]
<?>.wasm-function[core::ops::function::FnOnce::call_once::hab87f7f87cc27b57]@[wasm code]
<?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h4af976fb8feadc41]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hae943cd60f6c721e]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::hb98d876d4d54973d]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hdb703e667a2d6f90]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hd7b86f4302802012]@[wasm code]
<?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h7629e3f1fab1e802]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h24884d0d55b2449d]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h4b02328019d013e4]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hc8f6c64c5d8b5474]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h65e07fd55bf85a32]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::get::ha2ac11051ce3f8b7]@[wasm code]
<?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::hb2fe33e435a8e5ca]@[wasm code]
<?>.wasm-function[core::ops::function::FnOnce::call_once::hdff632307b1657b5]@[wasm code]
<?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h4af976fb8feadc41]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hae943cd60f6c721e]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::hb98d876d4d54973d]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hdb703e667a2d6f90]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hd7b86f4302802012]@[wasm code]
<?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h7629e3f1fab1e802]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h24884d0d55b2449d]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h4b02328019d013e4]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hc8f6c64c5d8b5474]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h65e07fd55bf85a32]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::get::ha2ac11051ce3f8b7]@[wasm code]
<?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h46bc021ddd7d91b9]@[wasm code]
<?>.wasm-function[core::ops::function::FnOnce::call_once::h00c0939943ad0d65]@[wasm code]
<?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h4af976fb8feadc41]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hae943cd60f6c721e]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::hb98d876d4d54973d]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hdb703e667a2d6f90]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hd7b86f4302802012]@[wasm code]
<?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h7629e3f1fab1e802]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h24884d0d55b2449d]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h4b02328019d013e4]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hc8f6c64c5d8b5474]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h65e07fd55bf85a32]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::get::ha2ac11051ce3f8b7]@[wasm code]
<?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h8ea729047343a475]@[wasm code]
<?>.wasm-function[core::ops::function::FnOnce::call_once::ha1bcd578a7c37d52]@[wasm code]
<?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h0fc28d23c61b9aee]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::h38b3a235a0e3586b]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::h9ee2b15ed2dcd096]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hf8dc23a2f518639f]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hf957ee343a9725e0]@[wasm code]
<?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h1c8ddd3e3acca42c]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h8174479387529063]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::hfb862dbfe1ccadb1]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::access::h8a0068444457ae48]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h7d1825b62af3f943]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::get::h06fc0f60e922f042]@[wasm code]
<?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h6b03bb1f6ce23712]@[wasm code]
<?>.wasm-function[core::ops::function::FnOnce::call_once::h788123225d284b08]@[wasm code]
<?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::hdc9b3921beaab537]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hca51ea1912fdaf77]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::h079d54fc0b6eb8ef]@[wasm code]
<?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hf8edf8f291b73fa7]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::h95c78b6e565a7697]@[wasm code]
<?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::hfd41752ee8e7abba]@[wasm code]
<?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::ha03975d5d4d6a5e9]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h014181543b6a4bbd]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::access::h3735660768126b25]@[wasm code]
<?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h43e7158bab839ace]@[wasm code]
<?>.wasm-function[i_slint_core::properties::Property<T>::get::h2dd59116d36fd8f3]@[wasm code]
<?>.wasm-function[i_slint_core::items::Empty::y::h1444ff81ac6fef1e]@[wasm code]
<?>.wasm-function[<i_slint_core::items::Empty as i_slint_core::items::Item_vtable_mod::Item>::geometry::hf096d660ca18f67b]@[wasm code]
<?>.wasm-function[i_slint_core::items::EmptyVTable::geometry::hff675e50bbb20ada]@[wasm code]
<?>.wasm-function[i_slint_core::items::Item_vtable_mod::ItemTO::geometry::h36bec4dc61bbc522]@[wasm code]
<?>.wasm-function[i_slint_core::item_rendering::ItemRenderer::filter_item::h454162c34d2c8182]@[wasm code]

    (anonymous function) (promptpro.js:407)
    logError (promptpro.js:232)
    wasm-stub
    <?>.wasm-function[console_error_panic_hook::error::h07edd14f5ab4938a]
    <?>.wasm-function[console_error_panic_hook::hook_impl::hc1a2448a3af8836b]
    <?>.wasm-function[console_error_panic_hook::hook::h66175824eee585e1]
    <?>.wasm-function[core::ops::function::Fn::call::h5dc9eb6b125f9291]
    <?>.wasm-function[std::panicking::rust_panic_with_hook::hc53aea0352e77326]
    <?>.wasm-function[std::panicking::begin_panic_handler::{{closure}}::ha183a8279614f03a]
    <?>.wasm-function[std::sys_common::backtrace::__rust_end_short_backtrace::hc33870f333461503]
    <?>.wasm-function[rust_begin_unwind]
    <?>.wasm-function[core::panicking::panic_fmt::hf4a9df75710ece83]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hcc933590d569ec70]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::hc0cfa7ccfa0df651]
    <?>.wasm-function[i_slint_core::properties::Property<T>::get::h1594bdce57fa9ded]
    <?>.wasm-function[i_slint_core::items::text::TextInput::text::heeac9325492dd910]
    <?>.wasm-function[<i_slint_core::items::text::TextInput as i_slint_core::items::Item_vtable_mod::Item>::layout_info::hdde72a4ca255ee4d]
    <?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::he7f22189b9347bde]
    <?>.wasm-function[core::ops::function::FnOnce::call_once::h025c2d9aa5ec80c6]
    <?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::hdc9b3921beaab537]
    <?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hca51ea1912fdaf77]
    <?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::h079d54fc0b6eb8ef]
    <?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hf8edf8f291b73fa7]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::h95c78b6e565a7697]
    <?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::hfd41752ee8e7abba]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::ha03975d5d4d6a5e9]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h014181543b6a4bbd]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::access::h3735660768126b25]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h43e7158bab839ace]
    <?>.wasm-function[i_slint_core::properties::Property<T>::get::h2dd59116d36fd8f3]
    <?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h8b1113656f73c251]
    <?>.wasm-function[core::ops::function::FnOnce::call_once::hab87f7f87cc27b57]
    <?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h4af976fb8feadc41]
    <?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hae943cd60f6c721e]
    <?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::hb98d876d4d54973d]
    <?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hdb703e667a2d6f90]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hd7b86f4302802012]
    <?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h7629e3f1fab1e802]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h24884d0d55b2449d]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h4b02328019d013e4]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hc8f6c64c5d8b5474]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h65e07fd55bf85a32]
    <?>.wasm-function[i_slint_core::properties::Property<T>::get::ha2ac11051ce3f8b7]
    <?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::hb2fe33e435a8e5ca]
    <?>.wasm-function[core::ops::function::FnOnce::call_once::hdff632307b1657b5]
    <?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h4af976fb8feadc41]
    <?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hae943cd60f6c721e]
    <?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::hb98d876d4d54973d]
    <?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hdb703e667a2d6f90]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hd7b86f4302802012]
    <?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h7629e3f1fab1e802]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h24884d0d55b2449d]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h4b02328019d013e4]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hc8f6c64c5d8b5474]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h65e07fd55bf85a32]
    <?>.wasm-function[i_slint_core::properties::Property<T>::get::ha2ac11051ce3f8b7]
    <?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h46bc021ddd7d91b9]
    <?>.wasm-function[core::ops::function::FnOnce::call_once::h00c0939943ad0d65]
    <?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h4af976fb8feadc41]
    <?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hae943cd60f6c721e]
    <?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::hb98d876d4d54973d]
    <?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hdb703e667a2d6f90]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hd7b86f4302802012]
    <?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h7629e3f1fab1e802]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h24884d0d55b2449d]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h4b02328019d013e4]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::access::hc8f6c64c5d8b5474]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h65e07fd55bf85a32]
    <?>.wasm-function[i_slint_core::properties::Property<T>::get::ha2ac11051ce3f8b7]
    <?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h8ea729047343a475]
    <?>.wasm-function[core::ops::function::FnOnce::call_once::ha1bcd578a7c37d52]
    <?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::h0fc28d23c61b9aee]
    <?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::h38b3a235a0e3586b]
    <?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::h9ee2b15ed2dcd096]
    <?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hf8dc23a2f518639f]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::hf957ee343a9725e0]
    <?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h1c8ddd3e3acca42c]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::h8174479387529063]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::hfb862dbfe1ccadb1]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::access::h8a0068444457ae48]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h7d1825b62af3f943]
    <?>.wasm-function[i_slint_core::properties::Property<T>::get::h06fc0f60e922f042]
    <?>.wasm-function[promptpro::slint_generatedApp::InnerComponent_empty_13::init::{{closure}}::h6b03bb1f6ce23712]
    <?>.wasm-function[core::ops::function::FnOnce::call_once::h788123225d284b08]
    <?>.wasm-function[slint::private_unstable_api::set_property_binding::{{closure}}::hdc9b3921beaab537]
    <?>.wasm-function[<F as i_slint_core::properties::Binding<T>>::evaluate::hca51ea1912fdaf77]
    <?>.wasm-function[i_slint_core::properties::Property<T>::set_binding::{{closure}}::h079d54fc0b6eb8ef]
    <?>.wasm-function[<F as i_slint_core::properties::BindingCallable>::evaluate::hf8edf8f291b73fa7]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::{{closure}}::h95c78b6e565a7697]
    <?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::hfd41752ee8e7abba]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::evaluate::ha03975d5d4d6a5e9]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::{{closure}}::h014181543b6a4bbd]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::access::h3735660768126b25]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::update::h43e7158bab839ace]
    <?>.wasm-function[i_slint_core::properties::Property<T>::get::h2dd59116d36fd8f3]
    <?>.wasm-function[i_slint_core::items::Empty::y::h1444ff81ac6fef1e]
    <?>.wasm-function[<i_slint_core::items::Empty as i_slint_core::items::Item_vtable_mod::Item>::geometry::hf096d660ca18f67b]
    <?>.wasm-function[i_slint_core::items::EmptyVTable::geometry::hff675e50bbb20ada]
    <?>.wasm-function[i_slint_core::items::Item_vtable_mod::ItemTO::geometry::h36bec4dc61bbc522]
    <?>.wasm-function[i_slint_core::item_rendering::ItemRenderer::filter_item::h454162c34d2c8182]
    <?>.wasm-function[i_slint_core::item_rendering::render_item_children::{{closure}}::hdfef172ddb38bd2c]
    <?>.wasm-function[i_slint_core::item_tree::<impl i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitor for T>::visit_item::hacbf8ca4cc5d285d]
    <?>.wasm-function[i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item::h77ed1658d4357cee]
    <?>.wasm-function[i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item::h58aed1375d60e8da]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::{{closure}}::h7546381a32a372d0]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::hef66f76ce3b28851]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerComponent_empty_13 as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item::h30cbffa58881ab0a]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerComponent_empty_13 as const_field_offset::PinnedDrop>::drop::VT::visit_children_item::ha77f18fc6c0936e2]
    <?>.wasm-function[i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item::h86fda6526c0b896d]
    <?>.wasm-function[i_slint_core::item_rendering::render_item_children::h0341d59671185383]
    <?>.wasm-function[i_slint_core::item_rendering::render_item_children::{{closure}}::hdfef172ddb38bd2c]
    <?>.wasm-function[i_slint_core::item_tree::<impl i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitor for T>::visit_item::hacbf8ca4cc5d285d]
    <?>.wasm-function[i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item::h77ed1658d4357cee]
    <?>.wasm-function[i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item::h58aed1375d60e8da]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::{{closure}}::h7546381a32a372d0]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::hef66f76ce3b28851]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerComponent_empty_13 as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item::h30cbffa58881ab0a]
    <?>.wasm-function[i_slint_core::model::Repeater<C>::visit::h6a635c38cfbea4e4]
    <?>.wasm-function[promptpro::slint_generatedApp::InnerApp::visit_dynamic_children::h8b638f699cf4a373]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item::visit_dynamic::h2c62823b054e06ae]
    <?>.wasm-function[core::ops::function::Fn::call::h1b576ceb87685e3e]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::{{closure}}::h7e1c8436c0ba05f7]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::h7668093295b51b71]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item::h1876321c48218958]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerApp as const_field_offset::PinnedDrop>::drop::VT::visit_children_item::h6fe0eecdc850512e]
    <?>.wasm-function[i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item::h86fda6526c0b896d]
    <?>.wasm-function[i_slint_core::item_rendering::render_item_children::h0341d59671185383]
    <?>.wasm-function[i_slint_core::item_rendering::render_item_children::{{closure}}::hdfef172ddb38bd2c]
    <?>.wasm-function[i_slint_core::item_tree::<impl i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitor for T>::visit_item::hacbf8ca4cc5d285d]
    <?>.wasm-function[i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item::h77ed1658d4357cee]
    <?>.wasm-function[i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorTO::visit_item::h58aed1375d60e8da]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::{{closure}}::h7e1c8436c0ba05f7]
    <?>.wasm-function[i_slint_core::item_tree::visit_item_tree::h7668093295b51b71]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerApp as i_slint_core::component::Component_vtable_mod::Component>::visit_children_item::h1876321c48218958]
    <?>.wasm-function[<promptpro::slint_generatedApp::InnerApp as const_field_offset::PinnedDrop>::drop::VT::visit_children_item::h6fe0eecdc850512e]
    <?>.wasm-function[i_slint_core::component::Component_vtable_mod::ComponentTO::visit_children_item::h86fda6526c0b896d]
    <?>.wasm-function[i_slint_core::item_rendering::render_item_children::h0341d59671185383]
    <?>.wasm-function[i_slint_core::item_rendering::render_component_items::h52613816308f1611]
    <?>.wasm-function[i_slint_renderer_femtovg::FemtoVGRenderer::render::{{closure}}::h42638ee99c740740]
    <?>.wasm-function[i_slint_core::window::WindowInner::draw_contents::{{closure}}::h8375362fb7260714]
    <?>.wasm-function[i_slint_core::properties::CURRENT_BINDING::<impl i_slint_core::properties::CURRENT_BINDING>::set::h8329f8939cc5716e]
    <?>.wasm-function[i_slint_core::properties::PropertyTracker<DirtyHandler>::evaluate_as_dependency_root::he118a8cccfae9261]
    <?>.wasm-function[i_slint_core::window::WindowInner::draw_contents::h244e78efb0f80a3a]
    <?>.wasm-function[i_slint_renderer_femtovg::FemtoVGRenderer::render::h588db16f1842a367]
    <?>.wasm-function[<i_slint_backend_winit::renderer::femtovg::GlutinFemtoVGRenderer as i_slint_backend_winit::renderer::WinitCompatibleRenderer>::render::h597af353856e3851]
    <?>.wasm-function[<i_slint_backend_winit::glwindow::GLWindow<Renderer> as i_slint_backend_winit::event_loop::WinitWindow>::draw::h663b51dc4a65daee]
    <?>.wasm-function[i_slint_backend_winit::event_loop::run::{{closure}}::h7089f0d9e2c76b74]
    <?>.wasm-function[i_slint_backend_winit::event_loop::run::{{closure}}::{{closure}}::h3144092437a3915c]
    <?>.wasm-function[i_slint_backend_winit::event_loop::CURRENT_WINDOW_TARGET::<impl i_slint_backend_winit::event_loop::CURRENT_WINDOW_TARGET>::set::h9d7499e623a7859f]
    <?>.wasm-function[i_slint_backend_winit::event_loop::run::{{closure}}::hde9acbd473f0f6ba]
    <?>.wasm-function[winit::platform_impl::platform::event_loop::EventLoop<T>::spawn::{{closure}}::h6215f9101e62beaa]
    <?>.wasm-function[<alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut::h45b817d80f7007da]
    <?>.wasm-function[winit::platform_impl::platform::event_loop::runner::Runner<T>::handle_single_event::h80c5626a6b1a6471]
    <?>.wasm-function[winit::platform_impl::platform::event_loop::runner::Shared<T>::handle_event::h1a11656dcd18b695]
    <?>.wasm-function[winit::platform_impl::platform::event_loop::runner::Shared<T>::run_until_cleared::hb320f61758a28372]
    <?>.wasm-function[winit::platform_impl::platform::event_loop::runner::Shared<T>::send_events::h0d0ce18b61dad21d]
    <?>.wasm-function[winit::platform_impl::platform::event_loop::runner::Shared<T>::send_event::hc7340cb438a65625]
    <?>.wasm-function[winit::platform_impl::platform::event_loop::proxy::EventLoopProxy<T>::send_event::h6fe0296bc672c519]
    <?>.wasm-function[winit::event_loop::EventLoopProxy<T>::send_event::hcb3cecbf742ad2b5]
    <?>.wasm-function[i_slint_backend_winit::event_loop::GlobalEventLoopProxyOrEventQueue::send_event::h2c49298d228fbdc2]
    <?>.wasm-function[<<i_slint_backend_winit::Backend as i_slint_core::platform::Platform>::new_event_loop_proxy::Proxy as i_slint_core::platform::EventLoopProxy>::invoke_from_event_loop::{{closure}}::h353eb0666d286b9c]
    <?>.wasm-function[std::thread::local::LocalKey<T>::try_with::h4326b4344e03710d]
    <?>.wasm-function[std::thread::local::LocalKey<T>::with::hfc5539eb6059b30a]
    <?>.wasm-function[<<i_slint_backend_winit::Backend as i_slint_core::platform::Platform>::new_event_loop_proxy::Proxy as i_slint_core::platform::EventLoopProxy>::invoke_from_event_loop::hc8205f9888dc6266]
    <?>.wasm-function[i_slint_core::api::invoke_from_event_loop::h02b21503fa03e5c6]
    <?>.wasm-function[i_slint_backend_winit::glwindow::GLWindow<Renderer>::call_with_event_loop::h5277ab641da2046b]
    <?>.wasm-function[<i_slint_backend_winit::glwindow::GLWindow<Renderer> as i_slint_core::window::WindowAdapterSealed>::request_window_properties_update::h089077f6a23beb50]
    <?>.wasm-function[<i_slint_core::window::WindowPropertiesTracker as i_slint_core::properties::PropertyDirtyHandler>::notify::had760b88a2868a8c]
    <?>.wasm-function[i_slint_core::properties::PropertyTracker<DirtyHandler>::new_with_dirty_handler::mark_dirty::h481e2c38760a48ae]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::{{closure}}::h25038a9109d3cb4c]
    <?>.wasm-function[i_slint_core::properties::dependency_tracker::DependencyListHead<T>::for_each::h84bca04021516bb6]
    <?>.wasm-function[i_slint_core::properties::mark_dependencies_dirty::h3c53cde48668830e]
    <?>.wasm-function[i_slint_core::properties::PropertyHandle::mark_dirty::hd6e0866a4c0c21a1]
    <?>.wasm-function[i_slint_core::properties::Property<T>::set::hd0b13cb06677299d]
    <?>.wasm-function[<i_slint_core::properties::Property<T>::link_two_way::TwoWayBinding<T> as i_slint_core::properties::BindingCallable>::intercept_set::h79cca8de138293c5]
    <?>.wasm-function[i_slint_core::properties::alloc_binding_holder::intercept_set::h0e274192a1bc31e9]
tronical commented 1 year ago

This is nasty. Somehow a redraw request is queued up in winit's event queue, and changing the text marks the WindowPropertiesTracker as dirty. That in turn calls request_window_properties_update, which basically uses corelib::api::invoke_from_event_loop to attempt to invoke a closure that'll append CustomEvent::UpdateWindowProperties to the winit event loop. Sadly, send_event on winit's EventLoopProxy ends up in the web platform Runner's send_events, which processes all events right away. That way the earlier draw event is triggered, and properties are recursively queried :-(

tronical commented 1 year ago

@jturcotte I vaguely recall that you had similar issues before. Do you happen to remember a reliable way of posting an event to the loop while making sure it won't empty the queue right away?

jturcotte commented 1 year ago

Only what's currently in master: https://github.com/slint-ui/slint/commit/041238708f461a3bc1caa06ca7bf3d89e31c1426

But I haven't tried the wasm platform for a while now, so maybe things need to be updated since this was already relying on winit implementation details more than it should. For instance, please note the filter that was added to run_fn to prevent overwriting the Poll control flow when handling other events.

ogoffart commented 1 year ago

In recent Slint, the keyboard event are handled in a invoke_from_event_loop context. Does that fixes anything?

fankaiLiu commented 1 year ago

Thanks for still caring about this issue,I upgraded the slint version to 1.1.0, but the problem still seems to exist.This question is beyond my current level, if you want to reproduce the problemthe link is here :)

ogoffart commented 9 months ago

@fankaiLiu When pressing the "run" button, your code panics with

 panicked at config/load_cofig.rs:14:23:
不存在配置文件:./config.toml,错误信息:operation not supported on this platform

And indeed, the code does File::open, which is not supported in wasm. I do believe the original panic is fixed. So i'm going to close this issue.

fankaiLiu commented 9 months ago

@fankaiLiu When pressing the "run" button, your code panics with

 panicked at config/load_cofig.rs:14:23:
不存在配置文件:./config.toml,错误信息:operation not supported on this platform

And indeed, the code does File::open, which is not supported in wasm. I do believe the original panic is fixed. So i'm going to close this issue.

I appreciate your answer, thank you and have a great day!