Skip to content

Segfault on wayland in twp_get_active_workspace_number (setting a wallpaper in thunar)

Version information

thunar 4.18.11 (Xfce 4.18) Debian unstable

Steps to reproduce

  1. use a wayland compositor such as sway
  2. navigate to an image (such as a .jpg), right click and select "Set as wallpaper"
  3. we get a segfault in XNextRequest() in libX11.so.6 triggered by gdk_x11_display_error_trap_push() in twp_get_active_workspace_number()

Current behavior

Thunar just exits (Segfault).

Expected outcome

We would like to be able to use thunar to select background images as intended by setting the gnome background picture-uri gsetting. XDG_CURRENT_DESKTOP=GNOME would achieve this. We're using a background daemon, gde-background, that correctly reacts to this setting. So if thunar wouldn't crash here, people could easily pick background images using thunar on a wayland desktop with any background image services that are gnome compatible. I think it would be sufficient by just skipping the whole X11 querying code if there's a GdkWaylandDisplay. I'd be grateful if you considered this. A lot of people use thunar as a lightweight file manager on wayland desktops such as sway and wayfire.

Backtrace

(gdb) bt
#0  0x00007ffff6c58889 in XNextRequest () at /lib/x86_64-linux-gnu/libX11.so.6
#1  0x00007ffff757f8af in gdk_x11_display_error_trap_push (display=0x55555568dc10 [GdkWaylandDisplay]) at ../../../gdk/x11/gdkdisplay-x11.c:2834
#2  0x00007ffff5717741 in twp_get_active_workspace_number (screen=0x555555690740 [GdkWaylandScreen]) at ./plugins/thunar-wallpaper/twp-provider.c:340
#3  twp_action_set_wallpaper (item=<optimized out>, user_data=0x7fffa4ab4740) at ./plugins/thunar-wallpaper/twp-provider.c:212
#8  0x00007ffff711b723 in <emit signal 'activate' on instance 0x55555690fa20 [ThunarxMenuItem]>
    (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3582
    #4  0x00007ffff70ff9c0 in g_closure_invoke
    (closure=0x555556a0fb10, return_value=0x0, n_param_values=1, param_values=0x7fffffffc5c0, invocation_hint=0x7fffffffc510) at ../../../gobject/gclosure.c:833
    #5  0x00007ffff7113d83 in signal_emit_unlocked_R
    (node=node@entry=0x7fffffffc680, detail=detail@entry=0, instance=instance@entry=0x55555690fa20, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffc5c0) at ../../../gobject/gsignal.c:3887
    #6  0x00007ffff71157a9 in signal_emit_valist_unlocked
    (instance=instance@entry=0x55555690fa20, signal_id=signal_id@entry=464, detail=detail@entry=0, var_args=var_args@entry=0x7fffffffc7e0)
    at ../../../gobject/gsignal.c:3519
    #7  0x00007ffff711b666 in g_signal_emit_valist (instance=0x55555690fa20, signal_id=464, detail=0, var_args=0x7fffffffc7e0) at ../../../gobject/gsignal.c:3262
#9  0x00007ffff7f80b67 in thunarx_menu_item_activate (item=<optimized out>) at ./thunarx/thunarx-menu-item.c:347

...