pa_hook_fire(&device->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED], device);
}
-static void device_remove_all(pa_bluetooth_discovery *y) {
- pa_bluetooth_device *d;
-
- pa_assert(y);
-
- while ((d = pa_hashmap_steal_first(y->devices))) {
- set_device_info_valid(d, -1);
- device_free(d);
- }
-}
-
static pa_bluetooth_adapter* adapter_create(pa_bluetooth_discovery *y, const char *path) {
pa_bluetooth_adapter *a;
if (pa_streq(name, BLUEZ_SERVICE)) {
if (old_owner && *old_owner) {
pa_log_debug("Bluetooth daemon disappeared");
- device_remove_all(y);
+ pa_hashmap_remove_all(y->devices);
pa_hashmap_remove_all(y->adapters);
y->objects_listed = false;
}
y->core = c;
y->adapters = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
(pa_free_cb_t) adapter_free);
- y->devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ y->devices = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
+ (pa_free_cb_t) device_free);
y->transports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
PA_LLIST_HEAD_INIT(pa_dbus_pending, y->pending);
pa_dbus_free_pending_list(&y->pending);
- if (y->devices) {
- device_remove_all(y);
+ if (y->devices)
pa_hashmap_free(y->devices);
- }
if (y->adapters)
pa_hashmap_free(y->adapters);