mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
dbus: Fix the ActivePort property handler
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
This commit is contained in:
parent
7d9e792d16
commit
e9513b40db
1 changed files with 10 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue