sdl2-compat: surface: Fix crash when unlocking an RLE surface

From 3c9aca03f4bb719b7cdeceb8c5ad9ac17ff2b0dc Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Mon, 28 Apr 2025 22:44:40 -0500
Subject: [PATCH] surface: Fix crash when unlocking an RLE surface

The surface may be reallocated with SIMD alignment by SDL3, so we synchronize the flags with the SDL2 surface to indicate that.

Fixes #471
---
 src/sdl2_compat.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index b12c283..ccec56a 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -9948,8 +9948,7 @@ SDL_LockSurface(SDL2_Surface *surface)
         if (!SDL3_LockSurface(surface3)) {
             return -1;
         }
-        surface->pixels = surface3->pixels;
-        surface->pitch = surface3->pitch;
+        SynchronizeSurface3to2(surface3, surface);
     }
 
     /* Increment the surface lock count, for recursive locks */
@@ -9971,8 +9970,7 @@ SDL_UnlockSurface(SDL2_Surface *surface)
 
     SDL3_UnlockSurface(surface3);
 
-    surface->pixels = surface3->pixels;
-    surface->pitch = surface3->pitch;
+    SynchronizeSurface3to2(surface3, surface);
 }
 
 SDL_DECLSPEC int SDLCALL