From 1c6d996108997fc53109673948d2e2f4e80ff5d6 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 14 Oct 2023 23:17:59 -0400
Subject: [PATCH] testaudio: if the SDL_Renderer is already gone, don't destroy
SDL_Textures.
---
test/testaudio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/testaudio.c b/test/testaudio.c
index 1508098f2191..83bdd4163e59 100644
--- a/test/testaudio.c
+++ b/test/testaudio.c
@@ -732,7 +732,9 @@ static void LoadStockWavThings(void)
static void DestroyTexture(Texture *tex)
{
if (tex) {
- SDL_DestroyTexture(tex->texture);
+ if (state->renderers[0] != NULL) { /* if the renderer went away, this pointer is already bogus. */
+ SDL_DestroyTexture(tex->texture);
+ }
SDL_free(tex);
}
}