mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 16:54:38 +08:00
Fix avoid starting AVDTP disconnect timer twice
Remove starting the timer when setting the AVDTP state to idle. If
needed, the timer should probably already have been started in
avdtp_unref when the reference count goes to one.
Since reference counting is handled in avdtp_ref and avdtp_unref, it
seems reasonable that not to inspect the count outside of those
functions.
The issue was found when using Device.Disconnect to disconnect a
headset. It was revealed by commit
c72ce0f12a
.
Before the commit, the timer was removed and then started again.
After applying it, the idle callback (disconnect_timeout) is called
twice, causing a crash.
This commit is contained in:
parent
c72ce0f12a
commit
88ee4ce65f
@ -1034,8 +1034,6 @@ static void avdtp_sep_set_state(struct avdtp *session,
|
||||
/* Remove pending commands for this stream from the queue */
|
||||
cleanup_queue(session, stream);
|
||||
stream_free(stream);
|
||||
if (session->ref == 1 && !session->streams)
|
||||
set_disconnect_timer(session);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user