mixer-control: fix gvc_mixer_card_set_profiles API usage

In update_card, profile_list is incorrectly used also after its
ownership is transferred to the GvcMixerCard.  In practice, this causes
e.g. some profiles to go missing due to the list head being clobbered.

Fix this by calling gvc_mixer_card_set_profiles only after profiles_list
is no longer used for any other purpose.
This commit is contained in:
Pauli Virtanen 2022-01-12 20:07:44 +02:00
parent c5ab6037f4
commit 8e7a5a4c3e

View File

@ -2590,7 +2590,6 @@ update_card (GvcMixerControl *control,
} }
card = gvc_mixer_card_new (control->priv->pa_context, card = gvc_mixer_card_new (control->priv->pa_context,
info->index); info->index);
gvc_mixer_card_set_profiles (card, profile_list);
for (i = 0; i < info->n_ports; i++) { for (i = 0; i < info->n_ports; i++) {
GvcMixerCardPort *port; GvcMixerCardPort *port;
@ -2604,6 +2603,8 @@ update_card (GvcMixerControl *control,
port->profiles = determine_profiles_for_port (info->ports[i], profile_list); port->profiles = determine_profiles_for_port (info->ports[i], profile_list);
port_list = g_list_prepend (port_list, port); port_list = g_list_prepend (port_list, port);
} }
gvc_mixer_card_set_profiles (card, profile_list);
gvc_mixer_card_set_ports (card, port_list); gvc_mixer_card_set_ports (card, port_list);
is_new = TRUE; is_new = TRUE;
} }