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.
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(),