gmessages: Add static variables only if needed

The static variables win32_keep_fatal_message and fatal_msg_buf are only
used for Windows debug builds and those without G_WINAPI_ONLY_APP
defined.

These checks are already in place for consumer of fatal_msg_buf, so
extend their usage.
This commit is contained in:
Tobias Stoeckmann
2025-09-03 19:37:38 +02:00
parent b9d2fa3cdc
commit b030663112

View File

@@ -432,7 +432,7 @@ _g_log_abort (gboolean breakpoint)
g_abort ();
}
#ifdef G_OS_WIN32
#if defined(G_OS_WIN32) && (defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP))
static gboolean win32_keep_fatal_message = FALSE;
/* This default message will usually be overwritten. */
@@ -1109,7 +1109,7 @@ mklevel_prefix (gchar level_prefix[STRING_BUFFER_SIZE],
if (log_level & ALERT_LEVELS)
strcat (level_prefix, " **");
#ifdef G_OS_WIN32
#if defined(G_OS_WIN32) && (defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP))
if ((log_level & G_LOG_FLAG_FATAL) != 0 && !g_test_initialized ())
win32_keep_fatal_message = TRUE;
#endif