diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index e865a8c9f..d9dbd9613 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -67,6 +67,7 @@ load_dbus_syms(void) SDL_DBUS_SYM(error_free); SDL_DBUS_SYM(get_local_machine_id); SDL_DBUS_SYM(free); + SDL_DBUS_SYM(shutdown); #undef SDL_DBUS_SYM #undef SDL_DBUS_SYM2 @@ -106,7 +107,7 @@ LoadDBUSLibrary(void) void SDL_DBus_Init(void) { - if (LoadDBUSLibrary() != -1) { + if (!dbus.session_conn && LoadDBUSLibrary() != -1) { DBusError err; dbus.error_init(&err); dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); @@ -128,6 +129,7 @@ SDL_DBus_Quit(void) if (dbus.session_conn) { dbus.connection_close(dbus.session_conn); dbus.connection_unref(dbus.session_conn); + dbus.shutdown(); SDL_memset(&dbus, 0, sizeof(dbus)); } UnloadDBUSLibrary(); diff --git a/src/core/linux/SDL_dbus.h b/src/core/linux/SDL_dbus.h index 285b39d93..0fbb21422 100644 --- a/src/core/linux/SDL_dbus.h +++ b/src/core/linux/SDL_dbus.h @@ -62,7 +62,8 @@ typedef struct SDL_DBusContext { dbus_bool_t (*error_is_set)(const DBusError *); void (*error_free)(DBusError *); char *(*get_local_machine_id)(void); - void (*free)(void *); + void (*free)(void *); + void (*shutdown)(void); } SDL_DBusContext;