Diff between c8cc30465d7322c662f1928dbc681bcdaa97a3ab and e50edf7cbecf4f6b1cd79ac7523e674f2247ee66

Changed Files

File Additions Deletions Status
profiles/audio/avctp.c +7 -4 modified

Full Patch

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 41e2f46..303427e 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -490,10 +490,6 @@ static void avctp_set_state(struct avctp *session, avctp_state_t new_state)
 		break;
 	case AVCTP_STATE_CONNECTED:
 		DBG("AVCTP Connected");
-		if (session->browsing) {
-			avctp_channel_destroy(session->browsing);
-			session->browsing = NULL;
-		}
 		break;
 	case AVCTP_STATE_BROWSING_CONNECTING:
 		DBG("AVCTP Browsing Connecting");
@@ -817,6 +813,13 @@ send:
 
 failed:
 	DBG("AVCTP Browsing: disconnected");
+	avctp_set_state(session, AVCTP_STATE_CONNECTED);
+
+	if (session->browsing) {
+		avctp_channel_destroy(session->browsing);
+		session->browsing = NULL;
+	}
+
 	return FALSE;
 }