Call dbus_shutdown to make valgrind happy.

This commit is contained in:
Alex Baines 2014-07-06 22:15:31 +01:00
parent 1ee96bb994
commit 1c6cd67819
2 changed files with 5 additions and 2 deletions

View File

@ -67,6 +67,7 @@ load_dbus_syms(void)
SDL_DBUS_SYM(error_free); SDL_DBUS_SYM(error_free);
SDL_DBUS_SYM(get_local_machine_id); SDL_DBUS_SYM(get_local_machine_id);
SDL_DBUS_SYM(free); SDL_DBUS_SYM(free);
SDL_DBUS_SYM(shutdown);
#undef SDL_DBUS_SYM #undef SDL_DBUS_SYM
#undef SDL_DBUS_SYM2 #undef SDL_DBUS_SYM2
@ -106,7 +107,7 @@ LoadDBUSLibrary(void)
void void
SDL_DBus_Init(void) SDL_DBus_Init(void)
{ {
if (LoadDBUSLibrary() != -1) { if (!dbus.session_conn && LoadDBUSLibrary() != -1) {
DBusError err; DBusError err;
dbus.error_init(&err); dbus.error_init(&err);
dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err);
@ -128,6 +129,7 @@ SDL_DBus_Quit(void)
if (dbus.session_conn) { if (dbus.session_conn) {
dbus.connection_close(dbus.session_conn); dbus.connection_close(dbus.session_conn);
dbus.connection_unref(dbus.session_conn); dbus.connection_unref(dbus.session_conn);
dbus.shutdown();
SDL_memset(&dbus, 0, sizeof(dbus)); SDL_memset(&dbus, 0, sizeof(dbus));
} }
UnloadDBUSLibrary(); UnloadDBUSLibrary();

View File

@ -62,7 +62,8 @@ typedef struct SDL_DBusContext {
dbus_bool_t (*error_is_set)(const DBusError *); dbus_bool_t (*error_is_set)(const DBusError *);
void (*error_free)(DBusError *); void (*error_free)(DBusError *);
char *(*get_local_machine_id)(void); char *(*get_local_machine_id)(void);
void (*free)(void *); void (*free)(void *);
void (*shutdown)(void);
} SDL_DBusContext; } SDL_DBusContext;