From 88ee4ce65f27185b256e8c1354bdfe7cb3f16cf0 Mon Sep 17 00:00:00 2001 From: Daniel Orstadius Date: Mon, 1 Nov 2010 12:44:25 +0200 Subject: [PATCH] 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 c72ce0f12a8387a70a6f0109f13bd6f414f32be8. 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. --- audio/avdtp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/audio/avdtp.c b/audio/avdtp.c index 5e84a45da..611fd7bc6 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -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;