We always disconnect before free, move the state changed function in the free method. --- src/modules/bluetooth/bluez5-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index b5c0726..777aca9 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -197,6 +197,8 @@ void pa_bluetooth_transport_put(pa_bluetooth_transport *t) { void pa_bluetooth_transport_free(pa_bluetooth_transport *t) { pa_assert(t); + transport_state_changed(t, PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED); + if (t->dispose) t->dispose (t); pa_hashmap_remove(t->device->discovery->transports, t->path); @@ -414,7 +416,6 @@ static void device_free(pa_bluetooth_device *d) { if (!(t = d->transports[i])) continue; - transport_state_changed(t, PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED); pa_bluetooth_transport_free(t); } @@ -1435,7 +1436,6 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *conn, DBusMessa if ((t = pa_hashmap_get(y->transports, path))) { pa_log_debug("Clearing transport %s profile %s", t->path, pa_bluetooth_profile_to_string(t->profile)); - transport_state_changed(t, PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED); pa_bluetooth_transport_free(t); } -- 1.9.3