Add hint to make SDL handle dbus_shutdown()
parent
d3daba791a
commit
2348e8b6a2
|
@ -2706,7 +2706,6 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES "SDL_AUDIO_DEVICE_SAMPLE_FRAMES"
|
#define SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES "SDL_AUDIO_DEVICE_SAMPLE_FRAMES"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request SDL_AppIterate() be called at a specific rate.
|
* Request SDL_AppIterate() be called at a specific rate.
|
||||||
*
|
*
|
||||||
|
@ -2721,6 +2720,22 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_MAIN_CALLBACK_RATE "SDL_MAIN_CALLBACK_RATE"
|
#define SDL_HINT_MAIN_CALLBACK_RATE "SDL_MAIN_CALLBACK_RATE"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Let SDL handle dbus_shutdown().
|
||||||
|
*
|
||||||
|
* Only enable this option if no other dependency uses D-Bus.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Use this option to prevent memory leaks if your application doesn't use
|
||||||
|
* D-Bus other than through SDL.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT "SDL_SHUTDOWN_DBUS_ON_QUIT"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration of hint priorities
|
* An enumeration of hint priorities
|
||||||
|
|
|
@ -517,13 +517,13 @@ void SDL_Quit(void)
|
||||||
SDL_QuitTicks();
|
SDL_QuitTicks();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_ClearHints();
|
|
||||||
SDL_AssertionsQuit();
|
|
||||||
|
|
||||||
#ifdef SDL_USE_LIBDBUS
|
#ifdef SDL_USE_LIBDBUS
|
||||||
SDL_DBus_Quit();
|
SDL_DBus_Quit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SDL_ClearHints();
|
||||||
|
SDL_AssertionsQuit();
|
||||||
|
|
||||||
SDL_QuitProperties();
|
SDL_QuitProperties();
|
||||||
SDL_QuitLog();
|
SDL_QuitLog();
|
||||||
|
|
||||||
|
|
|
@ -183,14 +183,12 @@ void SDL_DBus_Quit(void)
|
||||||
dbus.connection_close(dbus.session_conn);
|
dbus.connection_close(dbus.session_conn);
|
||||||
dbus.connection_unref(dbus.session_conn);
|
dbus.connection_unref(dbus.session_conn);
|
||||||
}
|
}
|
||||||
/* Don't do this - bug 3950
|
|
||||||
dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it.
|
SDL_bool q = SDL_GetHintBoolean(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, SDL_FALSE);
|
||||||
*/
|
if (q == SDL_TRUE && dbus.shutdown) {
|
||||||
#if 0
|
|
||||||
if (dbus.shutdown) {
|
|
||||||
dbus.shutdown();
|
dbus.shutdown();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
SDL_zero(dbus);
|
SDL_zero(dbus);
|
||||||
UnloadDBUSLibrary();
|
UnloadDBUSLibrary();
|
||||||
SDL_free(inhibit_handle);
|
SDL_free(inhibit_handle);
|
||||||
|
|
Loading…
Reference in New Issue