Skip to content

Wayland/X11 mix-up causes crash in terminal_window_get_workspace

There was a crash reported in the Red Hat Bugzilla with 1.1.3 that looked interesting: https://bugzilla.redhat.com/show_bug.cgi?id=2313546

I was able to reproduce it with the following steps inside of a Fedora 40 VM:

  1. Log in with an Xfce session (X11)
  2. Start xfce4-terminal
  3. Run QT_QPA_PLATFORM=wayland dbus-launch kwin_wayland in the terminal
  4. In a new terminal tab, run xfce4-terminal to open a window in the compositor
  5. Choose Log Out from the Applications menu
  6. Ensure "Save session for future logins" is checked
  7. Log out to trigger a crash

The root cause seems to be the presence of a GdkWaylandDisplay object inside of an X11 code block:

#0  0x00007f200d88cb0a in XNextRequest (dpy=0x55d5a39c45d0) at /usr/src/debug/libX11-1.8.10-2.fc40.x86_64/src/Macros.c:148
        next_request = <optimized out>
#1  0x00007f200d71d94c in gdk_x11_display_error_trap_push (display=display@entry=0x55d5a39ab870 [GdkWaylandDisplay]) at ../gdk/x11/gdkdisplay-x11.c:2834
        display_x11 = 0x55d5a39ab870 [GdkWaylandDisplay]
        trap = 0x55d5a3f54160
#2  0x000055d5a33881ed in terminal_window_get_workspace (window=0x55d5a3d51960 [TerminalWindow]) at /usr/src/debug/xfce4-terminal-1.1.3-1.fc40.x86_64/terminal/terminal-window.c:2608
        gdk_display = 0x55d5a39ab870 [GdkWaylandDisplay]