diff options
Diffstat (limited to 'audio/headset.c')
-rw-r--r-- | audio/headset.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c index e1122bd6..ab4c4d8f 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -795,6 +795,13 @@ failed: return -1; } +gint headset_path_cmp(gconstpointer headset, gconstpointer path) +{ + const struct headset *hs = headset; + + return strcmp(hs->object_path, path); +} + gint headset_bda_cmp(gconstpointer headset, gconstpointer bda) { const struct headset *hs = headset; @@ -1559,6 +1566,12 @@ void headset_unref(struct headset *hs) { assert(hs != NULL); + if (hs->state > HEADSET_STATE_DISCONNECTED) + hs_disconnect(hs, NULL); + + if (!dbus_connection_unregister_object_path(hs->conn, hs->object_path)) + error("D-Bus failed to unregister %s path", hs->object_path); + dbus_connection_unref(hs->conn); g_free(hs); |