summaryrefslogtreecommitdiffstats
path: root/audio/headset.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-06-12 06:39:40 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-06-12 06:39:40 +0000
commitc1fe207c205d3122a496b11d36132940e34568a4 (patch)
tree31bf77cd14eac0af55df8592ce8cbd2c13aa23e7 /audio/headset.c
parentddf8edc54d666f9b6f75f28b6db5375e2f0982a8 (diff)
Fix triggering an assert if the SCO connect callback gets triggered on the
same mainloop iteration as the RFCOMM disconnect callback.
Diffstat (limited to 'audio/headset.c')
-rw-r--r--audio/headset.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 2d398324..d6cc7751 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -85,6 +85,7 @@ typedef enum {
struct pending_connect {
DBusMessage *msg;
GIOChannel *io;
+ guint io_id;
};
struct headset {
@@ -1036,6 +1037,8 @@ static DBusHandlerResult hs_disconnect(DBusConnection *conn, DBusMessage *msg,
if (hs->pending_connect) {
if (hs->pending_connect->io)
g_io_channel_close(hs->pending_connect->io);
+ if (hs->pending_connect->io_id)
+ g_source_remove(hs->pending_connect->io_id);
if (hs->pending_connect->msg)
err_connect_failed(connection,
hs->pending_connect->msg,
@@ -1439,8 +1442,9 @@ static DBusHandlerResult hs_play(DBusConnection *conn, DBusMessage *msg,
}
debug("SCO connect in progress");
- g_io_add_watch(c->io, G_IO_OUT | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
- (GIOFunc) sco_connect_cb, device);
+ c->io_id = g_io_add_watch(c->io,
+ G_IO_OUT | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
+ (GIOFunc) sco_connect_cb, device);
} else {
debug("SCO connect succeeded with first try");
do_callback = TRUE;