From c1fe207c205d3122a496b11d36132940e34568a4 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 12 Jun 2007 06:39:40 +0000 Subject: Fix triggering an assert if the SCO connect callback gets triggered on the same mainloop iteration as the RFCOMM disconnect callback. --- audio/headset.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'audio/headset.c') 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; -- cgit