From 1636fb014845743c0000c4030cbf75c55bd3983f Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 13 Apr 2011 12:20:50 +0300 Subject: [PATCH] Fix unregistering a2dp sep while it is locked If sep is locked it should not be unregistered until properly unlocked. --- audio/a2dp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/audio/a2dp.c b/audio/a2dp.c index 1f3bc9967..741b134cc 100644 --- a/audio/a2dp.c +++ b/audio/a2dp.c @@ -1686,6 +1686,9 @@ void a2dp_remove_sep(struct a2dp_sep *sep) } } + if (sep->locked) + return; + a2dp_unregister_sep(sep); } @@ -2286,7 +2289,9 @@ gboolean a2dp_sep_lock(struct a2dp_sep *sep, struct avdtp *session) gboolean a2dp_sep_unlock(struct a2dp_sep *sep, struct avdtp *session) { + struct a2dp_server *server = sep->server; avdtp_state_t state; + GSList *l; state = avdtp_sep_get_state(sep->lsep); @@ -2294,6 +2299,17 @@ gboolean a2dp_sep_unlock(struct a2dp_sep *sep, struct avdtp *session) DBG("SEP %p unlocked", sep->lsep); + if (sep->type == AVDTP_SEP_TYPE_SOURCE) + l = server->sources; + else + l = server->sinks; + + /* Unregister sep if it was removed */ + if (g_slist_find(l, sep) == NULL) { + a2dp_unregister_sep(sep); + return TRUE; + } + if (!sep->stream || state == AVDTP_STATE_IDLE) return TRUE; -- 2.47.3