SDL: Updated documentation for SDL_HINT_SHUTDOWN_DBUS_ON_QUIT (5e12e)

From 5e12e4b81340a860637c057418a0fdbe8900ef2e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 7 Jan 2024 14:20:16 -0800
Subject: [PATCH] Updated documentation for SDL_HINT_SHUTDOWN_DBUS_ON_QUIT

(cherry picked from commit 3deefa6b438922d5d55cb881482f8550f51978b7)
---
 include/SDL_hints.h       | 18 +++++++++---------
 src/core/linux/SDL_dbus.c |  7 ++++---
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/include/SDL_hints.h b/include/SDL_hints.h
index db4fc2313f7f..7356bf4dbbc4 100644
--- a/include/SDL_hints.h
+++ b/include/SDL_hints.h
@@ -2667,18 +2667,18 @@ extern "C" {
 #define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY"
 
 /**
- * Let SDL handle dbus_shutdown().
+ * Cause SDL to call dbus_shutdown() on quit.
  *
- * Only enable this option if no other dependency uses D-Bus.
+ * This is useful as a debug tool to validate memory leaks, but shouldn't ever
+ * be set in production applications, as other libraries used by the application
+ * might use dbus under the hood and this cause cause crashes if they continue
+ * after SDL_Quit().
  *
- * This option tells SDL that it can safely call dbus_shutdown() when
- * SDL_Quit() is called. You must ensure that no other library still uses
- * D-Bus when SDL_Quit() is called, otherwise resources will be freed while
- * they are still in use, which results in undefined behavior and likely a
- * crash.
+ * This variable can be set to the following values:
+ *   "0"       - SDL will not call dbus_shutdown() on quit (default)
+ *   "1"       - SDL will call dbus_shutdown() on quit
  *
- * Use this option to prevent memory leaks if your application doesn't use
- * D-Bus other than through SDL.
+ * This hint is available since SDL 2.30.0.
  */
 #define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT "SDL_SHUTDOWN_DBUS_ON_QUIT"
 
diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c
index 4a9f397184fc..7d706c2386d2 100644
--- a/src/core/linux/SDL_dbus.c
+++ b/src/core/linux/SDL_dbus.c
@@ -187,9 +187,10 @@ void SDL_DBus_Quit(void)
         dbus.connection_unref(dbus.session_conn);
     }
 
-    SDL_bool q = SDL_GetHintBoolean(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, SDL_FALSE);
-    if (q == SDL_TRUE && dbus.shutdown) {
-        dbus.shutdown();
+    if (SDL_GetHintBoolean(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, SDL_FALSE)) {
+        if (dbus.shutdown) {
+            dbus.shutdown();
+        }
     }
 
     SDL_zero(dbus);