SDL: Don't allow further operations on properties while we're destroying them

From cf819ca818a5b5f120e01d5ddba0825a1eff2a8c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 26 Feb 2025 08:34:14 -0800
Subject: [PATCH] Don't allow further operations on properties while we're
 destroying them

Fixes https://github.com/libsdl-org/SDL/issues/12407
---
 src/SDL_properties.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/SDL_properties.c b/src/SDL_properties.c
index caadaeb820fe5..166ea0f918b30 100644
--- a/src/SDL_properties.c
+++ b/src/SDL_properties.c
@@ -126,9 +126,10 @@ void SDL_QuitProperties(void)
     // this can't just DestroyHashTable with SDL_FreeProperties as the destructor, because
     //  other destructors under this might cause use to attempt a recursive lock on SDL_properties,
     //  which isn't allowed with rwlocks. So manually iterate and free everything.
-    SDL_IterateHashTable(SDL_properties, FreeOneProperties, NULL);
-    SDL_DestroyHashTable(SDL_properties);
+    SDL_HashTable *properties = SDL_properties;
     SDL_properties = NULL;
+    SDL_IterateHashTable(properties, FreeOneProperties, NULL);
+    SDL_DestroyHashTable(properties);
 
     SDL_SetInitialized(&SDL_properties_init, false);
 }