pnmixer icon indicating copy to clipboard operation
pnmixer copied to clipboard

Segfault on wayland

Open SilverRainZ opened this issue 3 years ago • 3 comments

Env:

  • Arch Linux
  • sway 1:1.5.1-1
  • pnmixer-gtk3 0.7.2-3

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) 

SilverRainZ avatar Apr 01 '21 14:04 SilverRainZ

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.

hasufell avatar Apr 01 '21 15:04 hasufell

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...

anarcat avatar Oct 18 '23 03:10 anarcat

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

That'll likely be a rewrite.

hasufell avatar Oct 19 '23 01:10 hasufell