diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 968cb6f0ff..8075c3a2d8 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -598,6 +598,13 @@ static SDL_Cursor *Wayland_CreateDefaultCursor(void) static void Wayland_FreeCursorData(SDL_CursorData *d) { + SDL_VideoDevice *vd = SDL_GetVideoDevice(); + struct SDL_WaylandInput *input = vd->internal->input; + + if (input->current_cursor == d) { + input->current_cursor = NULL; + } + // Buffers for system cursors must not be destroyed. if (d->is_system_cursor) { if (d->cursor_data.system.frame_callback) {