nicklan / pnmixer

Volume mixer for the system tray
GNU General Public License v3.0
152 stars 32 forks source link

Segfault on wayland #190

Open SilverRainZ opened 3 years ago

SilverRainZ commented 3 years ago

Env:

Backtrace:

Starting program: /usr/bin/pnmixer 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff5979640 (LWP 215933)]
[New Thread 0x7ffff515a640 (LWP 215934)]
[New Thread 0x7ffff48e4640 (LWP 215935)]
[New Thread 0x7fffe7fff640 (LWP 215936)]
[New Thread 0x7fffe7193640 (LWP 215937)]

(pnmixer:215929): Gtk-CRITICAL **: 22:16:59.683: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed

Thread 1 "pnmixer" received signal SIGSEGV, Segmentation fault.
0x00007ffff7e09754 in XkbKeycodeToKeysym () from /usr/lib/libX11.so.6
(gdb) bt
#0  0x00007ffff7e09754 in XkbKeycodeToKeysym () at /usr/lib/libX11.so.6
#1  0x000055555555db7b in hotkey_new ()
#2  0x000055555555de68 in hotkeys_reload ()
#3  0x000055555555e1ae in hotkeys_new ()
#4  0x000055555555b16e in main ()
(gdb) 
hasufell commented 3 years ago

pnmixer wasn't written with wayland in mind. I can't use wayland, because of my graphics card, so I'm unable to test anything.

If you want to dig into the code, check

https://github.com/nicklan/pnmixer/blob/44fb908b1662b946e764a905f290ffdb65cbb397/src/hotkey.c#L171-L198

I'm suspecting disp = gdk_x11_get_default_xdisplay(); maybe fails and we get a null pointer.

anarcat commented 1 year ago

i'm also getting this in pnmixer under sway in Debian bookworm:

anarcat@angela:~$ pnmixer 

(pnmixer:681401): dbind-WARNING **: 23:46:21.393: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.systemd1.UnitMasked: Unit at-spi-dbus-bus.service is masked.

(pnmixer:681401): GVFS-WARNING **: 23:46:21.395: Error creating proxy: Error calling StartServiceByName for org.gtk.vfs.Daemon: Unit gvfs-daemon.service is masked. (g-io-error-quark, 36)

(pnmixer:681401): Gtk-CRITICAL **: 23:46:21.426: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed

(pnmixer:681401): GLib-GObject-WARNING **: 23:46:21.426: invalid cast from 'GdkWaylandScreen' to 'GdkX11Screen'

(pnmixer:681401): GLib-GObject-WARNING **: 23:46:21.426: invalid cast from 'GdkWaylandDisplay' to 'GdkX11Display'

(pnmixer:681401): GLib-GObject-WARNING **: 23:46:21.426: invalid cast from 'GdkWaylandDisplay' to 'GdkX11Display'
Segmentation fault (core dumped)

but yeah, looks like there's a bit too much x11-specific code in there... maybe there's a more backend-neutral way of doing this? from what i understand, it should be possible to write some GTK app that transparently works on x11 or wayland...

and for what it's worth it does start in Xwayland mode with:

GDK_BACKEND=x11 pnmixer 

... but unfortunately, in sway (with waybar as a tray-holder), i don't actually see the tray pop up...

hasufell commented 1 year ago

maybe there's a more backend-neutral way of doing this?

That'll likely be a rewrite.