The old code tried to look up the port object by using an object path,
but the ports hashmap uses port names as keys, so the method failed
always.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=85369
---
 src/modules/dbus/iface-device.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/modules/dbus/iface-device.c b/src/modules/dbus/iface-device.c
index 625f057..d469483 100644
--- a/src/modules/dbus/iface-device.c
+++ b/src/modules/dbus/iface-device.c
@@ -725,6 +725,8 @@ static void handle_get_active_port(DBusConnection *conn, 
DBusMessage *msg, void
 static void handle_set_active_port(DBusConnection *conn, DBusMessage *msg, 
DBusMessageIter *iter, void *userdata) {
     pa_dbusiface_device *d = userdata;
     const char *new_active_path;
+    pa_dbusiface_device_port *port;
+    void *state;
     pa_dbusiface_device_port *new_active;
     int r;
 
@@ -747,7 +749,14 @@ static void handle_set_active_port(DBusConnection *conn, 
DBusMessage *msg, DBusM
 
     dbus_message_iter_get_basic(iter, &new_active_path);
 
-    if (!(new_active = pa_hashmap_get(d->ports, new_active_path))) {
+    PA_HASHMAP_FOREACH(port, d->ports, state) {
+        if (pa_streq(pa_dbusiface_device_port_get_path(port), 
new_active_path)) {
+            new_active = port;
+            break;
+        }
+    }
+
+    if (!new_active) {
         pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NOT_FOUND, "No such port: 
%s", new_active_path);
         return;
     }
-- 
1.9.3

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to