From 2d56d5e87b132b4f7ba33b87cebd1f0065e23325 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 14 Nov 2012 10:58:08 +0200 Subject: [PATCH] core: Fix manager_cleanup order This patch fixes the order in which things are cleaned up in manager_cleanup. The profiles need to be cleaned up first (since they are higher level constructs than adapters and devices) and we cannot remove the adapter from the manager list before calling adapter_remove since functions within adapter_remove may remove service records which in turn relies on having the adapter present in the manager list. --- src/manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/manager.c b/src/manager.c index 80b26e454..07f948201 100644 --- a/src/manager.c +++ b/src/manager.c @@ -245,16 +245,16 @@ static void manager_remove_adapter(struct btd_adapter *adapter) void manager_cleanup(const char *path) { + btd_profile_cleanup(); + while (adapters) { struct btd_adapter *adapter = adapters->data; - adapters = g_slist_remove(adapters, adapter); adapter_remove(adapter); + adapters = g_slist_remove(adapters, adapter); btd_adapter_unref(adapter); } - btd_profile_cleanup(); - btd_start_exit_timer(); g_dbus_unregister_interface(btd_get_dbus_connection(), -- 2.11.0