Call dbus_shutdown to make valgrind happy.
authorAlex Baines <alex@abaines.me.uk>
Sun, 06 Jul 2014 22:15:31 +0100
changeset 8977 84ae33058c67
parent 8976 1a5d959d7b32
child 8978 7753e4fd3d1d
Call dbus_shutdown to make valgrind happy.
src/core/linux/SDL_dbus.c
src/core/linux/SDL_dbus.h
--- a/src/core/linux/SDL_dbus.c	Mon Jul 07 10:26:28 2014 -0700
+++ b/src/core/linux/SDL_dbus.c	Sun Jul 06 22:15:31 2014 +0100
@@ -67,6 +67,7 @@
     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 @@
 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 @@
     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();
--- a/src/core/linux/SDL_dbus.h	Mon Jul 07 10:26:28 2014 -0700
+++ b/src/core/linux/SDL_dbus.h	Sun Jul 06 22:15:31 2014 +0100
@@ -62,7 +62,8 @@
     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;