From 23f53fa8f9eed39419a916d588fc4d9993fc3bef Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 6 Aug 2024 13:13:41 -0700
Subject: [PATCH] Reinitialize log prefixes in SDL_Init()
They may have been cleared in SDL_Quit()
---
src/sdl2_compat.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 34e4cb4..6fd48a3 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -810,6 +810,17 @@ static SDL_PropertiesID timers = 0;
/* Functions! */
+static void
+SDL2Compat_InitLogPrefixes(void)
+{
+ SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_VERBOSE, "VERBOSE: ");
+ SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_DEBUG, "DEBUG: ");
+ SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_INFO, "INFO: ");
+ SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_WARN, "WARN: ");
+ SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_ERROR, "ERROR: ");
+ SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_CRITICAL, "CRITICAL: ");
+}
+
/* this stuff _might_ move to SDL_Init later */
static int
SDL2Compat_InitOnStartup(void)
@@ -838,12 +849,7 @@ SDL2Compat_InitOnStartup(void)
SDL3_SetHint("SDL_BORDERLESS_WINDOWED_STYLE", "0");
SDL3_SetHint("SDL_VIDEO_SYNC_WINDOW_OPERATIONS", "1");
- SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_VERBOSE, "VERBOSE: ");
- SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_DEBUG, "DEBUG: ");
- SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_INFO, "INFO: ");
- SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_WARN, "WARN: ");
- SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_ERROR, "ERROR: ");
- SDL3_SetLogPriorityPrefix(SDL_LOG_PRIORITY_CRITICAL, "CRITICAL: ");
+ SDL2Compat_InitLogPrefixes();
return 1;
@@ -4922,6 +4928,8 @@ SDL_InitSubSystem(Uint32 flags)
{
int ret;
+ SDL2Compat_InitLogPrefixes();
+
/* Update IME UI hint */
if (flags & SDL_INIT_VIDEO) {
const char *old_hint;