macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

Segmentation fault when running on wayland and setting the linux backend as WaylandWithX11Fallback

Open nullptr97j opened this issue 1 year ago • 2 comments

main.rs:

use macroquad::prelude::*;

fn window_conf() -> Conf {
    Conf {
        window_title: "Window Conf".to_owned(),
        fullscreen: true,
        platform: miniquad::conf::Platform {
            linux_backend: miniquad::conf::LinuxBackend::WaylandWithX11Fallback,
            ..Default::default()
        },
        ..Default::default()
    }
}

#[macroquad::main(window_conf)]
async fn main() {
    loop {
        clear_background(RED);

        draw_line(40.0, 40.0, 100.0, 200.0, 15.0, BLUE);
        draw_rectangle(screen_width() / 2.0 - 60.0, 100.0, 120.0, 60.0, GREEN);
        draw_circle(screen_width() - 30.0, screen_height() - 30.0, 15.0, YELLOW);

        draw_text("IT WORKS!", 20.0, 20.0, 30.0, DARKGRAY);

        next_frame().await
    }
}

terminal output:

❯ cargo run
   Compiling rstellar v0.1.0 (/home/null/Desktop/CodingProjects/rstellar)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s
     Running `target/debug/rstellar`
[1]    69419 segmentation fault (core dumped)  cargo run

it is worth mentioning I am using Hyprland as my Wayland compositor, and also that using the x11 backend works partially but has a few quirks, those are probably xwayland issues anyway.

nullptr97j avatar Sep 26 '24 21:09 nullptr97j

Thanks for report. Does it only happen with WaylandWithX11Fallback, or with WaylandWithX11Fallback as well?

Also would really appreciate the stacktrace!

not-fl3 avatar Sep 26 '24 23:09 not-fl3

greetings! thank you for your patience and responding, I'd like to add that both WaylandWithX11Fallback and WaylandOnly cause this issue, here's the backtrace on top of that:

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/testing`
Received signal: 11
   0: testing::signal_handler
             at /home/null/Desktop/CodingProjects/capsule/testing/src/main.rs:12:14
   1: <unknown>
   2: wl_egl_window_resize
   3: miniquad::native::linux_wayland::xdg_toplevel_handle_configure
             at /home/null/.cargo/registry/src/index.crates.io-6f17d22bba15001f/miniquad-0.4.6/src/native/linux_wayland.rs:496:9
   4: <unknown>
   5: <unknown>
   6: ffi_call
   7: <unknown>
   8: <unknown>
   9: wl_display_dispatch_queue_pending
  10: wl_display_roundtrip_queue
  11: miniquad::native::linux_wayland::run
             at /home/null/.cargo/registry/src/index.crates.io-6f17d22bba15001f/miniquad-0.4.6/src/native/linux_wayland.rs:690:9
  12: miniquad::start
             at /home/null/.cargo/registry/src/index.crates.io-6f17d22bba15001f/miniquad-0.4.6/src/lib.rs:349:17
  13: macroquad::Window::from_config
             at /home/null/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.4.13/src/lib.rs:856:9
  14: testing::main
             at /home/null/Desktop/CodingProjects/capsule/testing/src/main.rs:45:1
  15: core::ops::function::FnOnce::call_once
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/core/src/ops/function.rs:250:5
  16: std::sys::backtrace::__rust_begin_short_backtrace
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/sys/backtrace.rs:154:18
  17: std::rt::lang_start::{{closure}}
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/rt.rs:164:18
  18: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/core/src/ops/function.rs:284:13
      std::panicking::try::do_call
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/panicking.rs:557:40
      std::panicking::try
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/panicking.rs:520:19
      std::panic::catch_unwind
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/panic.rs:345:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/rt.rs:143:48
      std::panicking::try::do_call
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/panicking.rs:557:40
      std::panicking::try
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/panicking.rs:520:19
      std::panic::catch_unwind
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/panic.rs:345:14
      std::rt::lang_start_internal
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/rt.rs:143:20
  19: std::rt::lang_start
             at /rustc/d6c8169c186ab16a3404cd0d0866674018e8a19e/library/std/src/rt.rs:163:17
  20: main
  21: <unknown>
  22: __libc_start_main
  23: _start

[1]    79561 IOT instruction (core dumped)  cargo run

it's worth mentioning that running the program in release mode makes no difference, thank you for your patience once again!

nullptr97j avatar Sep 28 '24 22:09 nullptr97j