SDL: Fixed infinite recursion initializing properties

From 407a3cb4e06e4524bbfa33db71cd1820e936982b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 8 Nov 2023 12:38:04 -0800
Subject: [PATCH] Fixed infinite recursion initializing properties

---
 src/SDL.c            |  1 +
 src/SDL_properties.c | 12 ++----------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/SDL.c b/src/SDL.c
index 46d668820d72..2959db874915 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -185,6 +185,7 @@ int SDL_InitSubSystem(Uint32 flags)
 
     SDL_InitLog();
     SDL_InitProperties();
+    SDL_GetGlobalProperties();
 
     /* Clear the error message */
     SDL_ClearError();
diff --git a/src/SDL_properties.c b/src/SDL_properties.c
index 49ae6866cdcc..31da31d32043 100644
--- a/src/SDL_properties.c
+++ b/src/SDL_properties.c
@@ -82,14 +82,6 @@ int SDL_InitProperties(void)
             return -1;
         }
     }
-
-    /* Create the global properties here to avoid race conditions later */
-    if (!SDL_global_properties) {
-        SDL_global_properties = SDL_CreateProperties();
-        if (!SDL_global_properties) {
-            return -1;
-        }
-    }
     return 0;
 }
 
@@ -111,8 +103,8 @@ void SDL_QuitProperties(void)
 
 SDL_PropertiesID SDL_GetGlobalProperties(void)
 {
-    if (!SDL_properties && SDL_InitProperties() < 0) {
-        return 0;
+    if (!SDL_global_properties) {
+        SDL_global_properties = SDL_CreateProperties();
     }
     return SDL_global_properties;
 }