Mercurial > audlegacy-plugins
changeset 2882:15754379dbd5
fixed the remove bonding bug and made it thread safe
author | Paula Stanciu <paula.stanciu@gmail.com> |
---|---|
date | Thu, 07 Aug 2008 20:00:52 +0300 |
parents | 66f53425a5dd |
children | 67d527114af5 |
files | src/bluetooth/agent.c src/bluetooth/bluetooth.c src/bluetooth/bluetooth.h |
diffstat | 3 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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)