summaryrefslogtreecommitdiff
path: root/audio/unix.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-04-07 17:09:26 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2009-04-07 17:09:26 +0300
commit22911b0b33e1279567f2893aadf02f6bdf1d4e8b (patch)
treefa743161f06d21a9fdd8a25500e2003dca8a5fba /audio/unix.c
parent12e8fa0f03bbd4a8755df40c14ca1fce8382906d (diff)
downloadbluez-22911b0b33e1279567f2893aadf02f6bdf1d4e8b.tar.gz
Fix device removal while audio IPC client is connected
Diffstat (limited to 'audio/unix.c')
-rw-r--r--audio/unix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/audio/unix.c b/audio/unix.c
index 7aca7eff7..1234f456a 100644
--- a/audio/unix.c
+++ b/audio/unix.c
@@ -1069,6 +1069,9 @@ static void start_close(struct audio_device *dev, struct unix_client *client,
struct a2dp_data *a2dp;
struct headset_data *hs;
+ if (!client->dev)
+ goto failed;
+
switch (client->type) {
case TYPE_HEADSET:
hs = &client->d.hs;
@@ -1538,6 +1541,18 @@ static gboolean server_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
return TRUE;
}
+void unix_device_removed(struct audio_device *dev)
+{
+ GSList *l;
+
+ for (l = clients; l != NULL; l = l->next) {
+ struct unix_client *client = l->data;
+
+ if (client->dev == dev)
+ client->dev = NULL;
+ }
+}
+
int unix_init(void)
{
GIOChannel *io;