mixer-card: Return in set_profile() when profile is already set

When we change the card profile, there's two paths the current profile gets
updated after the change: From _pa_context_set_card_profile_by_index_cb()
and from update_card() in gvc-mixer-control.c. Both call
gvc_mixer_card_set_profile(), and if the profile change was initiated by us,
we might call set_profile() twice. Handle this a bit better in set_profile()
and early-return in case the current profile is already set.
This commit is contained in:
Jonas Dreßler 2024-02-29 02:29:41 +01:00
parent cc46b231cf
commit f75ad37943

View File

@ -179,6 +179,9 @@ gvc_mixer_card_set_profile (GvcMixerCard *card,
g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE);
g_return_val_if_fail (card->priv->profiles != NULL, FALSE); g_return_val_if_fail (card->priv->profiles != NULL, FALSE);
if (g_strcmp0 (card->priv->profile, profile) == 0)
return TRUE;
g_free (card->priv->profile); g_free (card->priv->profile);
card->priv->profile = g_strdup (profile); card->priv->profile = g_strdup (profile);