summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorBharat Panda <bharat.panda@samsung.com>2015-12-09 12:29:41 +0530
committerBharat Panda <bharat.panda@samsung.com>2015-12-09 12:32:39 +0530
commit70c689b46b27c9c7528f3c38ce91e4afcf727cd7 (patch)
treec8ed9faaf13896dd38bfb0328116d7b467ff81c1 /profiles
parenta399864284077d907d9a6e67e796a12e11798b73 (diff)
downloadbluez-70c689b46b27c9c7528f3c38ce91e4afcf727cd7.tar.gz
bluez-70c689b46b27c9c7528f3c38ce91e4afcf727cd7.tar.bz2
bluez-70c689b46b27c9c7528f3c38ce91e4afcf727cd7.zip
audio/avrcp: Fix possible crash when current player is removed
If current player is removed a new player should be assigned. This is needed as the crash is obsereved while removing the assinged player. git repo link: http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=05790fa731e8387ee3e3808c9e1ffb8058ebd3df Change-Id: I3d66215e4af97b34155b74358ea0e76d7d3fde43
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/avrcp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index fa19d6da..058fc004 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -3358,10 +3358,15 @@ static void player_remove(gpointer data)
for (l = player->sessions; l; l = l->next) {
struct avrcp *session = l->data;
+ struct avrcp_data *controller = session->controller;
- session->controller->players = g_slist_remove(
- session->controller->players,
- player);
+ controller->players = g_slist_remove(controller->players,
+ player);
+
+ /* Check if current player is being removed */
+ if (controller->player == player)
+ controller->player = g_slist_nth_data(
+ controller->players, 0);
}
player_destroy(player);
@@ -3412,9 +3417,6 @@ static gboolean avrcp_get_media_player_list_rsp(struct avctp *conn,
i += len;
}
- if (g_slist_find(removed, session->controller->player))
- session->controller->player = NULL;
-
g_slist_free_full(removed, player_remove);
return FALSE;