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.
diff --git a/audio/avdtp.c b/audio/avdtp.c
index c3e009b..ed84b21 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -623,8 +623,6 @@
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 @@
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