From e2551c5f541e27e7745ac6a6216b437ea8b16186 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 20 Jan 2014 14:23:26 +0200 Subject: [PATCH] android/A2DP: Fix sending notification on bt_a2dp_unregister At this point IPC might have been closed already. --- android/a2dp.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/android/a2dp.c b/android/a2dp.c index 8ec03c8e8..5569691a4 100644 --- a/android/a2dp.c +++ b/android/a2dp.c @@ -119,8 +119,10 @@ static void unregister_endpoint(void *data) g_free(endpoint); } -static void a2dp_device_free(struct a2dp_device *dev) +static void a2dp_device_free(void *data) { + struct a2dp_device *dev = data; + if (dev->idle_id > 0) g_source_remove(dev->idle_id); @@ -1471,13 +1473,6 @@ fail: return false; } -static void a2dp_device_disconnected(gpointer data, gpointer user_data) -{ - struct a2dp_device *dev = data; - - bt_a2dp_notify_state(dev, HAL_A2DP_STATE_DISCONNECTED); -} - void bt_a2dp_unregister(void) { DBG(""); @@ -1488,7 +1483,7 @@ void bt_a2dp_unregister(void) g_slist_free_full(endpoints, unregister_endpoint); endpoints = NULL; - g_slist_foreach(devices, a2dp_device_disconnected, NULL); + g_slist_free_full(devices, a2dp_device_free); devices = NULL; ipc_unregister(HAL_SERVICE_ID_A2DP); -- 2.47.3