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

segfault from xlib.XDefaultRootWindow with GDK_BACKEND=wayland #248

Closed
Congee opened this issue Nov 29, 2021 · 2 comments
Closed

segfault from xlib.XDefaultRootWindow with GDK_BACKEND=wayland #248

Congee opened this issue Nov 29, 2021 · 2 comments

Comments

@Congee
Copy link

Congee commented Nov 29, 2021

I don't have X11 nor Xwayland running. After taking a look at the problematic code, wayland seems not considered at all.

 /tmp/wikit$ GDK_DEBUG=xim RUSTFLAGS=-Awarnings GDK_BACKEND=wayland cargo r
 /tmp/wikit$ sudo coredumpctl debug
(gdb) info stack
#0  0x00007f6515cf0e50 in XDefaultRootWindow () from /nix/store/9mg4w9gk1bl4xx90painmfx47vn9acpl-libX11-1.7.2/lib/libX11.so.6
#1  0x0000555d95315ef4 in tao::platform_impl::platform::global_shortcut::{impl#0}::new::{closure#0}<tauri_runtime_wry::Message> ()
    at /home/cwu/.cargo/git/checkouts/tao-b2c91e21b396bd53/a297e14/src/platform_impl/linux/global_shortcut.rs:48
#2  0x0000555d952d4931 in std::sys_common::backtrace::__rust_begin_short_backtrace<tao::platform_impl::platform::global_shortcut::{impl#0}::new::{closure#0}, ()> (f=...) at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/std/src/sys_common/backtrace.rs:123
#3  0x0000555d9533ba5d in std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}<tao::platform_impl::platform::global_shortcut::{impl#0}::new::{closure#0}, ()> () at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/std/src/thread/mod.rs:484
#4  0x0000555d952f64b1 in core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}> (
    self=..., _args=()) at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/core/src/panic/unwind_safe.rs:271
#5  0x0000555d952bf099 in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (data=0x7f65118205d8) at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/std/src/panicking.rs:406
#6  0x0000555d952d484b in __rust_try ()
#7  0x0000555d952befd1 in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>> (f=...) at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/std/src/panicking.rs:370
#8  0x0000555d95272931 in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked::{closure#1}::{closure#0}>, ()> (f=...) at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/std/src/panic.rs:133
#9  0x0000555d9533b809 in std::thread::{impl#0}::spawn_unchecked::{closure#1}<tao::platform_impl::platform::global_shortcut::{impl#0}::new::{closure#0}, ()> () at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/std/src/thread/mod.rs:483
#10 0x0000555d9528e54f in core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked::{closure#1}, ()> ()
    at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/core/src/ops/function.rs:227
#11 0x0000555d95d35453 in alloc::boxed::{impl#44}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> ()
    at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/alloc/src/boxed.rs:1694
#12 alloc::boxed::{impl#44}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> () at /rustc/db9d361a4731ca0bb48533fab6297a8fea75696f/library/alloc/src/boxed.rs:1694
#13 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#14 0x00007f6516f37d3e in start_thread () from /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/libpthread.so.0
#15 0x00007f6516d2143f in clone () from /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/libc.so.6
quit)

Related code

pub(crate) fn new<T>(_window_target: &EventLoopWindowTarget<T>) -> Self {
let window_id = WindowId::dummy();
let hotkeys = ListenerMap::default();
let hotkey_map = hotkeys.clone();
let event_loop_channel = _window_target.p.window_requests_tx.clone();
let (method_sender, thread_receiver) = channel::unbounded();
let (thread_sender, method_receiver) = channel::unbounded();
std::thread::spawn(move || {
let event_loop_channel = event_loop_channel.clone();
let xlib = xlib::Xlib::open().unwrap();
unsafe {
let display = (xlib.XOpenDisplay)(ptr::null());
let root = (xlib.XDefaultRootWindow)(display);

Does tao actually support wayland natively?

@wusyong
Copy link
Member

wusyong commented Nov 29, 2021

We use x11-dl crate for global shortcut feature on Linux. We should support wayland too.
Other interface should be compatible with wayland since this module is the only one that uses it afaik

@amrbashir
Copy link
Member

should be fixed now with #308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants