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 on wayland #190

Open
SilverRainZ opened this issue Apr 1, 2021 · 3 comments
Open

Segfault on wayland #190

SilverRainZ opened this issue Apr 1, 2021 · 3 comments

Comments

@SilverRainZ
Copy link
Contributor

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) 
@hasufell
Copy link
Collaborator

hasufell commented Apr 1, 2021

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

pnmixer/src/hotkey.c

Lines 171 to 198 in 44fb908

/**
* Creates a new hotkey and grab it.
*
* @param code the key's code.
* @param mods the key's modifiers.
* @return the newly created Hotkey instance.
*/
Hotkey *
hotkey_new(guint code, GdkModifierType mods)
{
Hotkey *hotkey;
Display *disp;
hotkey = g_new0(Hotkey, 1);
disp = gdk_x11_get_default_xdisplay();
hotkey->code = code;
hotkey->mods = mods;
hotkey->sym = XkbKeycodeToKeysym(disp, hotkey->code, 0, 0);
hotkey->str = gtk_accelerator_name(hotkey->sym, hotkey->mods);
if (hotkey_grab(hotkey) == FALSE) {
hotkey_free(hotkey);
hotkey = NULL;
}
return hotkey;
}

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

@anarcat
Copy link

anarcat commented Oct 18, 2023

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
Copy link
Collaborator

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

That'll likely be a rewrite.

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

No branches or pull requests

3 participants