From 02c4478f9364ac9ba8c0b157c01e47c2f059552c Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 23 Oct 2025 08:23:56 +0300
Subject: [PATCH] SDL_ConvertSurface: clear sdl2-compat.surface2 on the
converted surface
Fixes https://github.com/libsdl-org/sdl2-compat/issues/534
---
src/video/SDL_surface.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
index 914b1c63b6e99..9ae4f21586cbd 100644
--- a/src/video/SDL_surface.c
+++ b/src/video/SDL_surface.c
@@ -2153,6 +2153,9 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
if (!SDL_CopyProperties(surface->props, SDL_GetSurfaceProperties(convert))) {
goto error;
}
+
+ // Make sure the new surface doesn't reference an old SDL2 surface.
+ SDL_ClearProperty(SDL_GetSurfaceProperties(convert), "sdl2-compat.surface2");
}
// We're ready to go!