Bug#1057620: doomsday: segfault in _XFlush() when Qt is using native Wayland
Simon McVittie
smcv at debian.org
Sun Dec 14 11:12:23 GMT 2025
On Sat, 13 Dec 2025 at 20:06:57 +0200, Adrian Bunk wrote:
>On Mon, May 06, 2024 at 10:28:40AM +0100, Simon McVittie wrote:
>> If Doomsday needs to use both SDL and Qt for graphics/windowing, probably
>> the right way to implement this would be to let one of those libraries
>> choose its backend (X11 or Wayland) according to its usual heuristic,
>> and then call configuration functions that force the other library to
>> make the same choice.
>
>Is this the same bug as #1113738?
That depends how you define "same bug", but it's certainly closely-related.
>If yes, does the workaround from Bernhard I NMUed there look correct to
>you?
If doomsday's Qt code doesn't work when using Qt's Wayland backend, then
the change you applied is necessary, but it might not be sufficient.
My concern about it would be what happens when Qt has been forced to use
X11 (by the patch you applied or by QT_QPA_PLATFORM=xcb in the
environment), but SDL is using native Wayland (via
SDL_VIDEODRIVER=wayland or replacing libsdl2-2.0-0 with
libsdl2-compat-shim). If doomsday code assumes that Qt windows on Unix
are always X11 windows, it is probably also assuming that SDL on Unix
will always be using the X11 backend.
If doomsday has that assumption, one way to make it be true would be to
call
SDL_SetHintWithPriority(SDL_HINT_VIDEODRIVER, "x11", SDL_HINT_OVERRIDE);
near the beginning of main(), before SDL_Init(). Or it could set
SDL_VIDEODRIVER=wayland as an environment variable, equivalent to what
you've done for Qt, which would have a similar effect.
All of this needs to happen before SDL initialization, and before the
program has had a chance to create a second thread, because setting
environment variables is not thread-safe and setting SDL hints is
probably also not thread-safe.
After discussion with SDL upstream, I'm hoping to make src:sdl2-compat
take over libsdl2-2.0-0 early in 2026, after which SDL 2 will default to
native Wayland in many environments, like GTK and Qt already do. Games
that assumed SDL will use X11 forever will need to adjust for that,
similar to what happened for GTK and Qt.
Users and developers can get a preview of the future SDL implementation
by replacing libsdl2-2.0-0 with libsdl2-compat-shim, and replacing
libsdl2-dev (if installed) with libsdl2-compat-dev.
smcv
More information about the Pkg-games-devel
mailing list