From 168f78b8b76c4a91cd744b03a816613a8273e250 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 18 Nov 2025 20:36:38 -0500 Subject: [PATCH] wayland: Free the cursors before stopping the event thread An active cursor being destroyed may still have a frame callback referencing the thread queue, so clean it up before destroying the thread queue to ensure that no references to the queue remain when it is destroyed. --- src/video/wayland/SDL_waylandmouse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 82529adf63..7e3aa255af 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -1492,17 +1492,17 @@ void Wayland_InitMouse(SDL_VideoData *data) void Wayland_FiniMouse(SDL_VideoData *data) { + for (int i = 0; i < SDL_arraysize(sys_cursors); i++) { + Wayland_FreeCursor(sys_cursors[i]); + sys_cursors[i] = NULL; + } + Wayland_DestroyCursorThread(data); Wayland_FreeCursorThemes(data); #ifdef SDL_USE_LIBDBUS Wayland_DBusFinishCursorProperties(); #endif - - for (int i = 0; i < SDL_arraysize(sys_cursors); i++) { - Wayland_FreeCursor(sys_cursors[i]); - sys_cursors[i] = NULL; - } } void Wayland_SeatUpdatePointerCursor(SDL_WaylandSeat *seat)