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

Cells example panics at 'already mutably borrowed: BorrowError' #4347

Closed
airstrike opened this issue Jan 16, 2024 · 1 comment
Closed

Cells example panics at 'already mutably borrowed: BorrowError' #4347

airstrike opened this issue Jan 16, 2024 · 1 comment
Labels
a:demos Demos and examples (mF,bO) bug Something isn't working

Comments

@airstrike
Copy link

Hi, I'm running Mac OS 14.2.1 and trying to run the cells example in the examples folder.

The example loads after building (in a tiny window that I can resize) and it continues to load fine after typing in numbers into cells. I'm even able to type 1+2 and see the result 3.

However, when I try to type a non-numeric character as the first character in a cell—such as =, ( or a—the program crashes with thread 'main' panicked at 'already mutably borrowed: BorrowError', examples/7guis/cells.rs:124:27

I first ran the example with $ SLINT_NO_QT=1 cargo run --release --bin cells which caused the crash

Below is the full output of $ RUST_BACKTRACE=full SLINT_NO_QT=1 cargo run --bin cells

warning: Component is neither used nor exported
  --> /Users/andy/projects/slint/examples/7guis/cells.slint:77:1
   |
77 | component Cell inherits MainWindow {
   | ^

    Finished dev [unoptimized + debuginfo] target(s) in 0.16s
     Running `/Users/andy/projects/slint/target/debug/cells`
thread 'main' panicked at 'already mutably borrowed: BorrowError', examples/7guis/cells.rs:124:27
stack backtrace:
   0:        0x100731a04 - std::backtrace_rs::backtrace::libunwind::trace::h65bc41667b946a9b
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:        0x100731a04 - std::backtrace_rs::backtrace::trace_unsynchronized::h11e85e00c64d2951
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x100731a04 - std::sys_common::backtrace::_print_fmt::hd30f3b7be3b8d9bb
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:65:5
   3:        0x100731a04 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h56d7672c82815b65
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:44:22
   4:        0x10074d094 - core::fmt::rt::Argument::fmt::h6ead82aa10d38e42
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/rt.rs:138:9
   5:        0x10074d094 - core::fmt::write::h632b3cc8e66b4f04
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/mod.rs:1094:21
   6:        0x10072f4d0 - std::io::Write::write_fmt::hc28441b249a4971d
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/io/mod.rs:1714:15
   7:        0x10073185c - std::sys_common::backtrace::_print::h0d2f8b8a08c5cc48
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:47:5
   8:        0x10073185c - std::sys_common::backtrace::print::h8057ced4b0f9fdc1
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:34:9
   9:        0x100732c1c - std::panicking::default_hook::{{closure}}::h8157fa8f0f7934b5
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:269:22
  10:        0x1007329ac - std::panicking::default_hook::hdaefe3bfb5fe212c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:288:9
  11:        0x10073314c - std::panicking::rust_panic_with_hook::h21091a3c79c5da9c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:705:13
  12:        0x100733058 - std::panicking::begin_panic_handler::{{closure}}::hd2f65b958d3068b8
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:597:13
  13:        0x100731de4 - std::sys_common::backtrace::__rust_end_short_backtrace::h53ec33e49ec66621
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:151:18
  14:        0x100732dc4 - rust_begin_unwind
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
  15:        0x10076b780 - core::panicking::panic_fmt::h3bbf9265d206434c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
  16:        0x10076bb40 - core::result::unwrap_failed::h1cd46f955b5f93b7
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/result.rs:1651:5
  17:        0x10008a5f4 - core::result::Result<T,E>::expect::h8a2a0fe5ac9126c4
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/result.rs:1033:23
[1]    62930 abort      RUST_BACKTRACE=full SLINT_NO_QT=1 cargo run --bin cells
@ogoffart
Copy link
Member

Thanks a lot for reporting the bug.
Should be fixed with commit ca881ea
We just were holding on a borrow_mut for too long.

@ogoffart ogoffart added bug Something isn't working a:demos Demos and examples (mF,bO) labels Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:demos Demos and examples (mF,bO) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants