summaryrefslogtreecommitdiff
path: root/audio
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
parent12e8fa0f03bbd4a8755df40c14ca1fce8382906d (diff)
downloadbluez-22911b0b33e1279567f2893aadf02f6bdf1d4e8b.tar.gz
Fix device removal while audio IPC client is connected
Diffstat (limited to 'audio')
-rw-r--r--audio/device.c3
-rw-r--r--audio/main.c2
-rw-r--r--audio/unix.c15
-rw-r--r--audio/unix.h2
4 files changed, 21 insertions, 1 deletions
diff --git a/audio/device.c b/audio/device.c
index 0f3f64051..e0bdb7b72 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -50,6 +50,7 @@
#include "ipc.h"
#include "dbus-common.h"
#include "device.h"
+#include "unix.h"
#include "avdtp.h"
#include "control.h"
#include "headset.h"
@@ -620,6 +621,8 @@ void audio_device_unregister(struct audio_device *device)
if (device->control)
control_unregister(device);
+ unix_device_removed(device);
+
g_dbus_unregister_interface(device->conn, device->path,
AUDIO_INTERFACE);
diff --git a/audio/main.c b/audio/main.c
index 8c35d541b..83d6d1527 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -41,8 +41,8 @@
#include "btio.h"
#include "plugin.h"
#include "logging.h"
-#include "unix.h"
#include "device.h"
+#include "unix.h"
#include "headset.h"
#include "manager.h"
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;
diff --git a/audio/unix.h b/audio/unix.h
index cb61c1e19..12cf3efe7 100644
--- a/audio/unix.h
+++ b/audio/unix.h
@@ -22,5 +22,7 @@
*
*/
+void unix_device_removed(struct audio_device *dev);
+
int unix_init(void);
void unix_exit(void);