SDL: Fixed some Wayland cursor related thread-safety warnings

From 64def01534acede3a1cd37d820fb2315f74c6e73 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 2 Jun 2026 15:53:31 -0700
Subject: [PATCH] Fixed some Wayland cursor related thread-safety warnings

---
 src/video/wayland/SDL_waylandmouse.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 92db17158ea56..861a0c0f215e7 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -565,18 +565,21 @@ void Wayland_CursorStateDestroyFrameCallback(SDL_WaylandCursorState *state)
     SDL_UnlockMutex(cursor_thread_context.lock);
 }
 
-static void Wayland_CursorStateResetAnimation(SDL_WaylandCursorState *state, bool lock)
+static void Wayland_CursorStateResetAnimationState(SDL_WaylandCursorState *state)
 {
-    if (lock) {
-        SDL_LockMutex(cursor_thread_context.lock);
-    }
-
     state->last_frame_callback_time_ms = SDL_GetTicks();
     state->current_frame_time_ms = 0;
     state->current_frame = 0;
+}
 
+static void Wayland_CursorStateResetAnimation(SDL_WaylandCursorState *state, bool lock)
+{
     if (lock) {
+        SDL_LockMutex(cursor_thread_context.lock);
+        Wayland_CursorStateResetAnimationState(state);
         SDL_UnlockMutex(cursor_thread_context.lock);
+    } else {
+        Wayland_CursorStateResetAnimationState(state);
     }
 }