When bluetoothd is not running we should not call RemoveRecord()
---
 plugins/bluetooth.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 161ae4b..5f2d80d 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;
-- 
1.7.4

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to