# HG changeset patch # User Paula Stanciu # Date 1218128452 -10800 # Node ID 15754379dbd5dc41024b1616be83f05de9d6eb20 # Parent 66f53425a5dda1825bb535ce74efce9ec3e5e603 fixed the remove bonding bug and made it thread safe diff -r 66f53425a5dd -r 15754379dbd5 src/bluetooth/agent.c --- a/src/bluetooth/agent.c Thu Aug 07 17:19:39 2008 +0300 +++ b/src/bluetooth/agent.c Thu Aug 07 20:00:52 2008 +0300 @@ -762,6 +762,8 @@ static void bonding_created(DBusGProxy *object, const char *address, gpointer user_data) { + bonded_dev_mutex = g_mutex_new (); + const char *adapter = NULL, *name = NULL; gchar *device, *text; @@ -779,6 +781,10 @@ device = g_strdup_printf("%s (%s)", name, address); } else device = g_strdup(address); + + g_mutex_lock(bonded_dev_mutex); + bonded_dev = g_strdup_printf(address); + g_mutex_unlock(bonded_dev_mutex); text = g_strdup_printf(_("Created bonding with %s"), device); bonding_finish = 1; diff -r 66f53425a5dd -r 15754379dbd5 src/bluetooth/bluetooth.c --- a/src/bluetooth/bluetooth.c Thu Aug 07 17:19:39 2008 +0300 +++ b/src/bluetooth/bluetooth.c Thu Aug 07 20:00:52 2008 +0300 @@ -89,6 +89,9 @@ void bt_about( void ) { printf("about call\n"); + dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_call(obj,"RemoveBonding",NULL,G_TYPE_STRING,((DeviceData*)(current_device->data))->address,G_TYPE_INVALID,G_TYPE_INVALID); + } void bt_cfg(void) @@ -127,7 +130,9 @@ static void remove_bonding() { dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_call(obj,"RemoveBonding",NULL,G_TYPE_STRING,"00:0D:3C:B1:1C:7A",G_TYPE_INVALID,G_TYPE_INVALID); + g_mutex_lock(bonded_dev_mutex); + dbus_g_proxy_call(obj,"RemoveBonding",NULL,G_TYPE_STRING,bonded_dev,G_TYPE_INVALID,G_TYPE_INVALID); + g_mutex_unlock(bonded_dev_mutex); } void refresh_call(void) diff -r 66f53425a5dd -r 15754379dbd5 src/bluetooth/bluetooth.h --- a/src/bluetooth/bluetooth.h Thu Aug 07 17:19:39 2008 +0300 +++ b/src/bluetooth/bluetooth.h Thu Aug 07 20:00:52 2008 +0300 @@ -47,5 +47,6 @@ gint discover_finish ; DBusGConnection * bus; DBusGProxy * obj; +gchar *bonded_dev; +GMutex *bonded_dev_mutex; -