mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Turn device ports into reference counted objects
Since both cards and sinks can hold references to a port, it makes sense to reference count them. Although no current implementation actually has sinks with ports but without a card, it felt wrong to make it harder to make such an implementation in the future. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
961ec210a6
commit
d9685ec85d
7 changed files with 138 additions and 69 deletions
|
|
@ -131,14 +131,8 @@ void pa_source_new_data_done(pa_source_new_data *data) {
|
|||
|
||||
pa_proplist_free(data->proplist);
|
||||
|
||||
if (data->ports) {
|
||||
pa_device_port *p;
|
||||
|
||||
while ((p = pa_hashmap_steal_first(data->ports)))
|
||||
pa_device_port_free(p);
|
||||
|
||||
pa_hashmap_free(data->ports, NULL, NULL);
|
||||
}
|
||||
if (data->ports)
|
||||
pa_device_port_hashmap_free(data->ports);
|
||||
|
||||
pa_xfree(data->name);
|
||||
pa_xfree(data->active_port);
|
||||
|
|
@ -671,14 +665,8 @@ static void source_free(pa_object *o) {
|
|||
if (s->proplist)
|
||||
pa_proplist_free(s->proplist);
|
||||
|
||||
if (s->ports) {
|
||||
pa_device_port *p;
|
||||
|
||||
while ((p = pa_hashmap_steal_first(s->ports)))
|
||||
pa_device_port_free(p);
|
||||
|
||||
pa_hashmap_free(s->ports, NULL, NULL);
|
||||
}
|
||||
if (s->ports)
|
||||
pa_device_port_hashmap_free(s->ports);
|
||||
|
||||
pa_xfree(s);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue