pop-os / cosmic-text

Pure Rust multi-line text handling

Home Page:https://pop-os.github.io/cosmic-text/cosmic_text/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

example editor-libcosmic crashes at startup

WhyNotHugo opened this issue · comments

commented

Running:

cargo clean
cargo run

I crashes at startup:

    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `/home/hugo/src/github.com/pop-os/cosmic-text/target/debug/editor-libcosmic`
svg icon 'Name("format-justify-left")' size 20 not found
svg icon 'Name("format-justify-center")' size 20 not found
svg icon 'Name("format-justify-right")' size 20 not found
svg icon 'Name("format-justify-fill")' size 20 not found
thread 'main' panicked at 'misaligned pointer dereference: address must be a multiple of 0x2 but is 0x7ffa320c4413', /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/internal/parse.rs:452:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'panic in a function that cannot unwind', library/core/src/panicking.rs:126:5
stack backtrace:
   0:     0x55723dbc2e6a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdf22feec95880e0d
   1:     0x55723dbe754f - core::fmt::write::h235c37951d00a89c
   2:     0x55723dbbfb65 - std::io::Write::write_fmt::h9bc27794617a6db9
   3:     0x55723dbc2c35 - std::sys_common::backtrace::print::h88a8b0be3878a062
   4:     0x55723dbc42de - std::panicking::default_hook::{{closure}}::h6164333d411d28b9
   5:     0x55723dbc4085 - std::panicking::default_hook::hab575ecd0a58206d
   6:     0x55723dbc483e - std::panicking::rust_panic_with_hook::h00441c5461358113
   7:     0x55723dbc46f2 - std::panicking::begin_panic_handler::{{closure}}::ha10326a5adba7763
   8:     0x55723dbc32d6 - std::sys_common::backtrace::__rust_end_short_backtrace::he5fc416511606524
   9:     0x55723dbc4492 - rust_begin_unwind
  10:     0x55723c427f83 - core::panicking::panic_nounwind_fmt::hc94c7db7a384e0e4
  11:     0x55723c428031 - core::panicking::panic_nounwind::h3073504210c4b8f8
  12:     0x55723c4281c3 - core::panicking::panic_cannot_unwind::hc75b58def32de0a1
  13:     0x55723cbf9aff - <u16 as swash::internal::parse::FromBeData>::from_be_data_unchecked::h99595792a7416591
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/internal/parse.rs:450:5
  14:     0x55723cbf9aff - <i16 as swash::internal::parse::FromBeData>::from_be_data_unchecked::h446e05bc48a6d378
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/internal/parse.rs:461:9
  15:     0x55723cbf935c - swash::internal::parse::Stream::read::h66d836185c5a71d4
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/internal/parse.rs:216:30
  16:     0x55723cb59eaf - swash::scale::glyf::scale::Scaler::load::h03a8f82d972ac272
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/scale/glyf/scale.rs:118:33
  17:     0x55723cb58d1b - swash::scale::glyf::scale::Scaler::scale::h535ce8c014dd64a7
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/scale/glyf/scale.rs:39:9
  18:     0x55723cc0c5b0 - swash::scale::Scaler::scale_outline_impl::he8b445a1ba1b85e7
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/scale/mod.rs:560:20
  19:     0x55723cc0e2e7 - swash::scale::Render::render_into::h0933b9ca6121aa40
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/scale/mod.rs:842:24
  20:     0x55723cc0e7fd - swash::scale::Render::render::hda4c73187d0bed4f
                               at /home/hugo/.local/state/cargo/registry/src/index.crates.io-6f17d22bba15001f/swash-0.1.6/src/scale/mod.rs:974:12
  21:     0x55723ca93101 - cosmic_text::swash::swash_image::hc33a1cf5f4537c4d
                               at /home/hugo/.local/state/cargo/git/checkouts/cosmic-text-92dc585b4973ff15/e788c17/src/swash.rs:43:5
  22:     0x55723ca933d4 - cosmic_text::swash::SwashCache::get_image::{{closure}}::h8fa25964bd3b858b
                               at /home/hugo/.local/state/cargo/git/checkouts/cosmic-text-92dc585b4973ff15/e788c17/src/swash.rs:126:32
  23:     0x55723ca94e0a - std::collections::hash::map::Entry<K,V>::or_insert_with::h94a2f9259e3403a4
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/collections/hash/map.rs:2558:43
  24:     0x55723ca93394 - cosmic_text::swash::SwashCache::get_image::hbf3e517cabb9f625
                               at /home/hugo/.local/state/cargo/git/checkouts/cosmic-text-92dc585b4973ff15/e788c17/src/swash.rs:124:9
  25:     0x55723c96e0e0 - iced_softbuffer::surface::draw_primitive::h0970a481c3b4741e
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/softbuffer/src/surface.rs:287:42
  26:     0x55723c4761f4 - iced_softbuffer::surface::Surface::present::{{closure}}::h5e9b10fd95213aef
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/softbuffer/src/surface.rs:80:21
  27:     0x55723c5006fa - iced_graphics::renderer::Renderer<B,T>::with_primitives::h780b7d08389fe880
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/graphics/src/renderer.rs:51:9
  28:     0x55723c4760cb - iced_softbuffer::surface::Surface::present::hb0ae66d43477e711
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/softbuffer/src/surface.rs:78:13
  29:     0x55723c511775 - <iced_softbuffer::window::compositor::Compositor<Theme> as iced_graphics::window::compositor::Compositor>::present::h9ee1693909a5e7fb
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/softbuffer/src/window/compositor.rs:77:9
  30:     0x55723c450e48 - iced_winit::application::run_instance::{{closure}}::hec88d22234ccea44
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/winit/src/application.rs:458:23
  31:     0x55723c453ba9 - iced_winit::application::run::{{closure}}::h45de27d32162e4bb
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/winit/src/application.rs:224:24
  32:     0x55723c5038e1 - winit::platform_impl::platform::sticky_exit_callback::hdb4634255939e89d
                               at /home/hugo/.local/state/cargo/git/checkouts/winit-40d7deb2b0c08730/d35712b/src/platform_impl/linux/mod.rs:854:9
  33:     0x55723c4d5411 - winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_return::h6cf7ad6e506a868c
                               at /home/hugo/.local/state/cargo/git/checkouts/winit-40d7deb2b0c08730/d35712b/src/platform_impl/linux/wayland/event_loop/mod.rs:529:21
  34:     0x55723c502bcd - winit::platform_impl::platform::EventLoop<T>::run_return::h3df2a42843711a4b
                               at /home/hugo/.local/state/cargo/git/checkouts/winit-40d7deb2b0c08730/d35712b/src/platform_impl/linux/mod.rs:753:56
  35:     0x55723c436eaa - <winit::event_loop::EventLoop<T> as winit::platform::run_return::EventLoopExtRunReturn>::run_return::hcb4fc8f721868fbc
                               at /home/hugo/.local/state/cargo/git/checkouts/winit-40d7deb2b0c08730/d35712b/src/platform/run_return.rs:62:9
  36:     0x55723c48340d - iced_winit::application::platform::run::h478018cc34c91229
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/winit/src/application.rs:776:17
  37:     0x55723c45371a - iced_winit::application::run::h10c3b95d5ebd8873
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/winit/src/application.rs:199:5
  38:     0x55723c49e4c6 - iced::application::Application::run::h074aaf50cb55273c
                               at /home/hugo/.local/state/cargo/git/checkouts/libcosmic-b367e32ffc370f4f/035ec88/iced/src/application.rs:216:12
  39:     0x55723c4fa8bd - editor_libcosmic::main::had6a56cb3faf4b8b
                               at /home/hugo/src/github.com/pop-os/cosmic-text/examples/editor-libcosmic/src/main.rs:81:5
  40:     0x55723c4ac8b2 - core::ops::function::FnOnce::call_once::h9a5a7cdd054932c7
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5
  41:     0x55723c4c65b5 - std::sys_common::backtrace::__rust_begin_short_backtrace::hcfa98379b0a7c986
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:134:18
  42:     0x55723c4e6c06 - std::rt::lang_start::{{closure}}::hedf5d57ef652265b
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:166:18
  43:     0x55723dbba5b2 - std::rt::lang_start_internal::h1181aa36d76c1285
  44:     0x55723c4e6bda - std::rt::lang_start::hb4772950ea42ef68
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:165:17
  45:     0x55723c4ff1fe - main
  46:     0x7ffa37499880 - libc_start_main_stage2
                               at /home/buildozer/aports/main/musl/src/1.2.4/src/env/__libc_start_main.c:95:2
thread caused non-unwinding panic. aborting.
zsh: abort      cargo run

Current HEAD is 2c8d7c0bb9b486b75b8282a66fb25afc0c4fdc17.

System info

I'm on alpine, using the system compiler:

> rustc --version
rustc 1.70.0 (90c541806 2023-05-31) (Alpine Linux 1.70.0-r3)
> rustup show
Default host: x86_64-unknown-linux-musl
rustup home:  /home/hugo/.local/state/rustup

installed toolchains
--------------------

nightly-x86_64-unknown-linux-musl
system (default)

active toolchain
----------------

system (default)
rustc 1.70.0 (90c541806 2023-05-31) (Alpine Linux 1.70.0-r3)
> cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.18.0
PRETTY_NAME="Alpine Linux v3.18"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

I'm not entirely sure if the issue is in libcosmic itself, or a dependency.

commented

Oh, seems to be dfrg/swash#38

Looks like Cargo.lock is ignored, so I had a stale one with an old swash. Updating or deleting it fixes the issue.