Diff between c96ff911c13db06a0338b6407fc37eadd5125f2d and 8a5b8c17ee00e1d0de8bf6566aa96ad20badf102

Changed Files

File Additions Deletions Status
src/adapter.c +9 -0 modified

Full Patch

diff --git a/src/adapter.c b/src/adapter.c
index 61d14ce..5a30fc0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1951,6 +1951,15 @@ static void adapter_free(gpointer user_data)
 	g_queue_foreach(adapter->auths, free_service_auth, NULL);
 	g_queue_free(adapter->auths);
 
+	/*
+	 * Unregister all handlers for this specific index since
+	 * the adapter bound to them is no longer valid.
+	 *
+	 * This also avoids having multiple instances of the same
+	 * handler in case indexes got removed and re-added.
+	 */
+	mgmt_unregister_index(adapter->mgmt, adapter->dev_id);
+
 	mgmt_unref(adapter->mgmt);
 
 	sdp_list_free(adapter->services, NULL);