floem icon indicating copy to clipboard operation
floem copied to clipboard

Application panics when entering Arabic characters in text_input

Open habics opened this issue 11 months ago • 3 comments

    Finished dev [unoptimized + debuginfo] target(s) in 0.41s
     Running `target\debug\floem-test.exe`
thread 'main' panicked at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\shape.rs:108:17:
begin <= end (2 <= 0) when slicing `تت`
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library\std\src\panicking.rs:647
   1: core::panicking::panic_fmt
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library\core\src\panicking.rs:72
   2: core::str::slice_error_fail_rt
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library\core\src\str\mod.rs:123
   3: core::str::slice_error_fail
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library\core\src\str\mod.rs:91
   4: core::str::traits::impl$7::index
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\core\src\str\traits.rs:231
   5: core::str::traits::impl$4::index<core::ops::range::Range<usize> >
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\core\src\str\traits.rs:61
   6: floem_cosmic_text::shape::shape_fallback
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\shape.rs:108
   7: floem_cosmic_text::shape::shape_run
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\shape.rs:220
   8: floem_cosmic_text::shape::ShapeWord::new
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\shape.rs:429
   9: floem_cosmic_text::shape::ShapeSpan::new
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\shape.rs:497
  10: floem_cosmic_text::shape::ShapeLine::new
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\shape.rs:613
  11: floem_cosmic_text::buffer_line::TextLayoutLine::shape
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\buffer_line.rs:200
  12: floem_cosmic_text::buffer_line::TextLayoutLine::layout
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\buffer_line.rs:222
  13: floem_cosmic_text::buffer::TextLayout::shape_until
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\buffer.rs:395
  14: floem_cosmic_text::buffer::TextLayout::shape_until_scroll
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\buffer.rs:454
  15: floem_cosmic_text::buffer::TextLayout::set_text
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-cosmic-text-0.7.0\src\buffer.rs:585
  16: floem::views::text_input::impl$1::update_text_layout::closure$0
             at C:\Users\Guess\Documents\repos\floem\src\views\text_input.rs:454
  17: floem_reactive::signal::signal_with_untracked<tuple$<>,alloc::string::String,floem::views::text_input::impl$1::update_text_layout::closure_env$0>      
             at C:\Users\Guess\Documents\repos\floem\reactive\src\signal.rs:401
  18: floem_reactive::signal::RwSignal<alloc::string::String>::with_untracked<alloc::string::String,tuple$<>,floem::views::text_input::impl$1::update_text_la
yout::closure_env$0>                                                                                                                                                      at C:\Users\Guess\Documents\repos\floem\reactive\src\signal.rs:88
  19: floem::views::text_input::TextInput::update_text_layout
             at C:\Users\Guess\Documents\repos\floem\src\views\text_input.rs:453
  20: floem::views::text_input::impl$3::compute_layout
             at C:\Users\Guess\Documents\repos\floem\src\views\text_input.rs:1118
  21: floem::view::impl$2::compute_layout
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:758
  22: floem::context::ComputeLayoutCx::compute_view_layout
             at C:\Users\Guess\Documents\repos\floem\src\context.rs:1329
  23: floem::view::default_compute_layout::closure$0<floem::views::stack::Stack>
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:319
  24: floem::views::stack::impl$1::for_each_child_mut
             at C:\Users\Guess\Documents\repos\floem\src\views\stack.rs:144
  25: floem::view::default_compute_layout<floem::views::stack::Stack>
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:318
  26: floem::view::Widget::compute_layout<floem::views::stack::Stack>
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:269
  27: floem::view::impl$2::compute_layout
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:758
  28: floem::context::ComputeLayoutCx::compute_view_layout
             at C:\Users\Guess\Documents\repos\floem\src\context.rs:1329
  29: floem::view::default_compute_layout::closure$0<floem::window_handle::WindowView>
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:319
  30: floem::window_handle::impl$2::for_each_child_mut
             at C:\Users\Guess\Documents\repos\floem\src\window_handle.rs:1617
  31: floem::view::default_compute_layout<floem::window_handle::WindowView>
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:318
  32: floem::view::Widget::compute_layout<floem::window_handle::WindowView>
             at C:\Users\Guess\Documents\repos\floem\src\view.rs:269
  33: floem::context::ComputeLayoutCx::compute_view_layout
             at C:\Users\Guess\Documents\repos\floem\src\context.rs:1329
  34: floem::window_handle::WindowHandle::compute_layout
             at C:\Users\Guess\Documents\repos\floem\src\window_handle.rs:520
  35: floem::window_handle::WindowHandle::layout
             at C:\Users\Guess\Documents\repos\floem\src\window_handle.rs:511
  36: floem::window_handle::WindowHandle::process_update_no_paint
             at C:\Users\Guess\Documents\repos\floem\src\window_handle.rs:674
  37: floem::window_handle::WindowHandle::process_update
             at C:\Users\Guess\Documents\repos\floem\src\window_handle.rs:647
  38: floem::window_handle::WindowHandle::event
             at C:\Users\Guess\Documents\repos\floem\src\window_handle.rs:341
  39: floem::window_handle::WindowHandle::key_event
             at C:\Users\Guess\Documents\repos\floem\src\window_handle.rs:388
  40: floem::app_handle::ApplicationHandle::handle_window_event
             at C:\Users\Guess\Documents\repos\floem\src\app_handle.rs:177
  41: floem::app::impl$1::run::closure$0
             at C:\Users\Guess\Documents\repos\floem\src\app.rs:145
  42: floem_winit::platform_impl::platform::event_loop::impl$3::run_on_demand::closure$0<floem::app::UserEvent,floem::app::impl$1::run::closure_env$0>       
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:272
  43: alloc::boxed::impl$48::call_mut<tuple$<enum2$<floem_winit::event::Event<floem::app::UserEvent> > >,dyn$<core::ops::function::FnMut<tuple$<enum2$<floem_
winit::event::Event<floem::app::UserEvent> > >,assoc$<Output,tuple$<> > > >,alloc::alloc::Global>                                                                         at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\alloc\src\boxed.rs:2022
  44: floem_winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop\runner.rs:246    
  45: core::panic::unwind_safe::impl$23::call_once<tuple$<>,floem_winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env
$0<floem::app::UserEvent> >                                                                                                                                               at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\core\src\panic\unwind_safe.rs:272
  46: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<floem_winit::platform_impl::platform::event_loop::runner::impl$3::call_event_ha
ndler::closure_env$0<floem::app::UserEvent> >,tuple$<> >                                                                                                                  at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\std\src\panicking.rs:554
  47: std::panicking::try::do_catch<core::panic::unwind_safe::AssertUnwindSafe<std::sys::pal::common::thread_local::fast_local::destroy_value::closure_env$0<
floem_reactive::signal::RwSignal<enum2$<core::option::Option<alloc::rc::Rc<floem::profiler::Profile,allo                                                       48: std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<floem_winit::platform_impl::platform::event_loop::runner::impl$3::call_event_ha
ndler::closure_env$0<floem::app::UserEvent> > >                                                                                                                           at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\std\src\panicking.rs:518
  49: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<floem_winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handle
r::closure_env$0<floem::app::UserEvent> >,tuple$<> >                                                                                                                      at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\std\src\panic.rs:142
  50: floem_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<floem::app::UserEvent>::catch_unwind<floem::app::UserEvent,tuple$<>,floem_win
it::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<floem::app::U                                                                  at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop\runner.rs:179    
  51: floem_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<floem::app::UserEvent>::call_event_handler<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop\runner.rs:242    
  52: floem_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<floem::app::UserEvent>::send_event<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop\runner.rs:232    
  53: floem_winit::platform_impl::platform::event_loop::WindowData<floem::app::UserEvent>::send_event<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:148
  54: floem_winit::platform_impl::platform::event_loop::public_window_callback_inner::closure$2<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:1061
  55: core::ops::function::FnOnce::call_once<floem_winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$2<floem::app::UserEv
ent>,tuple$<> >                                                                                                                                                           at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\core\src\ops\function.rs:250
  56: core::panic::unwind_safe::impl$23::call_once<tuple$<>,floem_winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$2<flo
em::app::UserEvent> >                                                                                                                                                     at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\core\src\panic\unwind_safe.rs:272
  57: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<floem_winit::platform_impl::platform::event_loop::public_window_callback_inner:
:closure_env$2<floem::app::UserEvent> >,tuple$<> >                                                                                                                        at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\std\src\panicking.rs:554
  58: std::panicking::try::do_catch<core::panic::unwind_safe::AssertUnwindSafe<std::sys::pal::common::thread_local::fast_local::destroy_value::closure_env$0<
floem_reactive::signal::RwSignal<enum2$<core::option::Option<alloc::rc::Rc<floem::profiler::Profile,allo                                                       59: std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<floem_winit::platform_impl::platform::event_loop::public_window_callback_inner:
:closure_env$2<floem::app::UserEvent> > >                                                                                                                                 at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\std\src\panicking.rs:518
  60: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<floem_winit::platform_impl::platform::event_loop::public_window_callback_inner::clo
sure_env$2<floem::app::UserEvent> >,tuple$<> >                                                                                                                            at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\std\src\panic.rs:142
  61: floem_winit::platform_impl::platform::event_loop::runner::EventLoopRunner<floem::app::UserEvent>::catch_unwind<floem::app::UserEvent,tuple$<>,floem_win
it::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$2<floem::app::UserEve                                                                  at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop\runner.rs:179    
  62: floem_winit::platform_impl::platform::event_loop::public_window_callback_inner<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:1071
  63: floem_winit::platform_impl::platform::event_loop::public_window_callback<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:1016
  64: DispatchMessageW
  65: CallWindowProcW
  66: wglSwapBuffers
  67: DispatchMessageW
  68: DispatchMessageW
  69: floem_winit::platform_impl::platform::event_loop::EventLoop<floem::app::UserEvent>::dispatch_peeked_messages<floem::app::UserEvent>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:485
  70: floem_winit::platform_impl::platform::event_loop::EventLoop<floem::app::UserEvent>::run_on_demand<floem::app::UserEvent,floem::app::impl$1::run::closur
e_env$0>                                                                                                                                                                  at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:283
  71: floem_winit::platform_impl::platform::event_loop::EventLoop<floem::app::UserEvent>::run<floem::app::UserEvent,floem::app::impl$1::run::closure_env$0>  
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\platform_impl\windows\event_loop.rs:254
  72: floem_winit::event_loop::EventLoop<floem::app::UserEvent>::run<floem::app::UserEvent,floem::app::impl$1::run::closure_env$0>
             at C:\Users\Guess\.cargo\registry\src\index.crates.io-6f17d22bba15001f\floem-winit-0.29.4\src\event_loop.rs:249
  73: floem::app::Application::run
             at C:\Users\Guess\Documents\repos\floem\src\app.rs:138
  74: floem::app::launch<floem::views::stack::Stack,floem::views::stack::Stack (*)()>
             at C:\Users\Guess\Documents\repos\floem\src\app.rs:34
  75: floem_test::main
             at .\src\main.rs:10
  76: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\core\src\ops\function.rs:250
  77: core::hint::black_box
             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66\library\core\src\hint.rs:334
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\floem-test.exe` (exit code: 101)

 *  The terminal process "C:\Users\Guess\.cargo\bin\cargo.exe 'run', '--package', 'floem-test', '--bin', 'floem-test'" terminated with exit code: 101. 

habics avatar Mar 08 '24 13:03 habics

Related to #250 most likely

dominikwilkowski avatar Mar 08 '24 21:03 dominikwilkowski

Not sure but maybe updating cosmic-text dependency to latest version solves this problem, current used one is 0.7.0 which seems pretty outdated.

habics avatar Mar 09 '24 06:03 habics

Hm, I'm surprised this happens since I don't remember Arabic having issues lying in cosmic-text. (I remember having to debug some issue a while back in Lapce, which this affects too)
But, our cosmic-text is customized so it isn't as simple as directly updating.

MinusGix avatar Mar 09 '24 07:03 MinusGix