diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index c670cdc18..11ab35cad 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -831,6 +831,7 @@ void Wayland_InitMouse(void) void Wayland_FiniMouse(SDL_VideoData *data) { struct SDL_WaylandInput *input = data->input; + int i; Wayland_FreeCursorThemes(data); @@ -840,6 +841,11 @@ void Wayland_FiniMouse(SDL_VideoData *data) SDL_DelHintCallback(SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP, Wayland_EmulateMouseWarpChanged, input); + + for (i = 0; i < SDL_arraysize(sys_cursors); i++) { + Wayland_FreeCursor(sys_cursors[i]); + sys_cursors[i] = NULL; + } } void Wayland_SetHitTestCursor(SDL_HitTestResult rc) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index 9c32b12f8..a91998152 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -511,6 +511,12 @@ void X11_QuitMouse(SDL_VideoDevice *_this) SDL_VideoData *data = _this->driverdata; SDL_XInput2DeviceInfo *i; SDL_XInput2DeviceInfo *next; + int j; + + for (j = 0; j < SDL_arraysize(sys_cursors); j++) { + X11_FreeCursor(sys_cursors[j]); + sys_cursors[j] = NULL; + } for (i = data->mouse_device_info; i; i = next) { next = i->next;