diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index e266c5f2fd..bddf90320c 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -1512,11 +1512,8 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this) { SDL_VideoData *data = _this->internal; SDL_WaylandSeat *seat, *tmp; - int i; - Wayland_FiniMouse(data); - - for (i = _this->num_displays - 1; i >= 0; --i) { + for (int i = _this->num_displays - 1; i >= 0; --i) { SDL_VideoDisplay *display = _this->displays[i]; Wayland_free_display(display, false); } @@ -1526,6 +1523,8 @@ static void Wayland_VideoCleanup(SDL_VideoDevice *_this) Wayland_SeatDestroy(seat, false); } + Wayland_FiniMouse(data); + if (data->pointer_constraints) { zwp_pointer_constraints_v1_destroy(data->pointer_constraints); data->pointer_constraints = NULL;