From fb4c6e07c820b476ee27fb755842b5316c697190 Mon Sep 17 00:00:00 2001 From: Aciz Date: Thu, 4 Dec 2025 16:52:22 +0200 Subject: [PATCH] Fix crash on Wayland when renderer was shutdown on fullscreen Wayland does not support mouse warping, and in turn 'SDL_WarpMouseGlobal', which causes the game to crash when for example using 'vid_restart' in fullscreen. --- src/sdl/sdl_glimp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c index ca6c8f8d..84f0937f 100644 --- a/src/sdl/sdl_glimp.c +++ b/src/sdl/sdl_glimp.c @@ -68,7 +68,12 @@ void GLimp_Shutdown( qboolean unloadDLL ) SDL_DestroyWindow( SDL_window ); SDL_window = NULL; - if ( glw_state.isFullscreen ) + if ( glw_state.isFullscreen +#ifdef __linux__ + // wayland does not support 'SDL_WarpMouseGlobal' and crashes if called + && Q_stricmp(SDL_GetCurrentVideoDriver(), "wayland") +#endif + ) SDL_WarpMouseGlobal( glw_state.desktop_width / 2, glw_state.desktop_height / 2 ); if ( unloadDLL )