summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-02-17 19:00:48 -0300
committerMarcel Holtmann <marcel@holtmann.org>2011-02-17 16:02:28 -0800
commit10caaadd9b044df70b06bd4362ab7d0207f328bc (patch)
treef06a494f052d4e92a77039bab93d9588333f2695
parentdf3d0d8365ba22f3a177b367d595df82a9349ba9 (diff)
downloadofono-10caaadd9b044df70b06bd4362ab7d0207f328bc.tar.bz2
bluetooth: fix crash by removing record
When bluetoothd is not running we should not call RemoveRecord()
-rw-r--r--plugins/bluetooth.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 161ae4ba..5f2d80dc 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -445,6 +445,9 @@ static void remove_record(struct server *server)
{
DBusMessage *msg;
+ if (server->handle == 0)
+ return;
+
msg = dbus_message_new_method_call(BLUEZ_SERVICE, adapter_any_path,
BLUEZ_SERVICE_INTERFACE,
"RemoveRecord");
@@ -596,6 +599,13 @@ static void new_connection(GIOChannel *io, gpointer user_data)
client_event, cbd);
}
+static void remove_service_handle(gpointer data, gpointer user_data)
+{
+ struct server *server = data;
+
+ server->handle = 0;
+}
+
static void add_record_cb(DBusPendingCall *call, gpointer user_data)
{
struct server *server = user_data;
@@ -767,6 +777,8 @@ static void bluetooth_disconnect(DBusConnection *connection, void *user_data)
return;
g_hash_table_foreach(uuid_hash, bluetooth_remove_all_modem, NULL);
+
+ g_slist_foreach(server_list, (GFunc) remove_service_handle, NULL);
}
static guint bluetooth_watch;