diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-06-17 02:30:52 +0300 |
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-06-17 02:37:06 +0300 |
| commit | 5ad144c5246ac274d0c6d1b40ca69b089a954274 (patch) | |
| tree | 02ce0350a367583c20ad28dba664894df0875d2d | |
| parent | 41b28f6b1003fe0ad55a23650464818d0c4c613a (diff) | |
| download | bluez-5ad144c5246ac274d0c6d1b40ca69b089a954274.tar.gz | |
Don't assert on AVDTP reference count bugs
In the case that the AVDTP session references weren't fully dropped when a
disconnection happens, in later reconnections the disconnect_timeout
function cound have a reference count higher than 1. These bugs naturally
need to fixed (and there's a proper error() call to log them) but we can
still handle the situation semi-cleanly instead of asserting and aborting
since the AVDTP session struct will just silently hang around and get
reused at the next connection attempt.
| -rw-r--r-- | audio/avdtp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c index c3e009b65..ed84b2178 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -623,8 +623,6 @@ static gboolean disconnect_timeout(gpointer user_data) struct audio_device *dev; gboolean stream_setup; - assert(session->ref == 1); - session->dc_timer = 0; stream_setup = session->stream_setup; session->stream_setup = FALSE; @@ -992,6 +990,11 @@ static void connection_lost(struct avdtp *session, int err) session->io_id = 0; } + if (session->dc_timer) + remove_disconnect_timer(session); + + session->auto_dc = TRUE; + if (session->ref != 1) error("connection_lost: ref count not 1 after all callbacks"); else |
