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

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

Open
nullptr97j opened this issue Sep 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@nullptr97j
Copy link

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.

@not-fl3
Copy link
Owner

not-fl3 commented Sep 26, 2024

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

Also would really appreciate the stacktrace!

@not-fl3 not-fl3 added the bug Something isn't working label Sep 26, 2024
@nullptr97j
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants