Unref D-Bus connections when not using them anymore
authorRafaël Carré <funman@videolan.org>
Tue, 21 Nov 2006 16:34:02 +0000 (16:34 +0000)
committerRafaël Carré <funman@videolan.org>
Tue, 21 Nov 2006 16:34:02 +0000 (16:34 +0000)
modules/control/dbus.c
modules/misc/probe/hal.c
modules/services_discovery/hal.c
src/libvlc-common.c

index dad21f5..62de186 100644 (file)
@@ -459,6 +459,8 @@ static void Close   ( vlc_object_t *p_this )
     PL_UNLOCK;
     pl_Release( p_playlist );
 
+    dbus_connection_unref( p_intf->p_sys->p_conn );
+
     free( p_intf->p_sys );
 }
 
index d16926d..c5bd738 100644 (file)
@@ -32,6 +32,7 @@
  *****************************************************************************/
 struct probe_sys_t
 {
+    DBusConnection *p_connection;
     LibHalContext *p_ctx;
     int            i_devices;
     device_t     **pp_devices;
@@ -88,10 +89,12 @@ static int Open( vlc_object_t *p_this )
         free( p_probe->p_sys );
         return VLC_EGENERIC;
     }
+    p_sys->p_connection = p_connection;
     libhal_ctx_set_dbus_connection( p_probe->p_sys->p_ctx, p_connection );
     if( !libhal_ctx_init( p_probe->p_sys->p_ctx, &dbus_error ) )
     {
         msg_Err( p_probe, "hal not available : %s", dbus_error.message );
+        dbus_connection_unref( p_connection );
         dbus_error_free( &dbus_error );
         free( p_sys );
         return VLC_EGENERIC;
@@ -106,6 +109,7 @@ static void Close( vlc_object_t *p_this )
 {
     device_probe_t *p_probe = (device_probe_t *) p_this;
     probe_sys_t *p_sys = p_probe->p_sys;
+    dbus_connection_unref( p_sys->p_connection );
     free( p_sys );
 }
 
index 7d0166f..08cce13 100644 (file)
@@ -196,6 +196,8 @@ static void Close( vlc_object_t *p_this )
     }
     free( p_sys );
 #ifdef HAVE_HAL_1
+    dbus_connection_unref( p_sys->p_connection );
+
     struct udi_input_id_t *p_udi_entry;
 
     while( p_sys->i_devices_number > 0 )
index aeed915..e9a9a42 100644 (file)
@@ -1840,6 +1840,7 @@ static void InitDeviceValues( libvlc_int_t *p_vlc )
 
 #ifdef HAVE_HAL_1
         libhal_ctx_shutdown( ctx, NULL );
+        dbus_connection_unref( p_connection );
 #else
         hal_shutdown( ctx );
 #endif