From f75ad37943ef2a58a1397ae15c84ab06b514fe89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 29 Feb 2024 02:29:41 +0100 Subject: [PATCH] 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. --- gvc-mixer-card.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gvc-mixer-card.c b/gvc-mixer-card.c index 39f59ca..fbc29f6 100644 --- a/gvc-mixer-card.c +++ b/gvc-mixer-card.c @@ -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 (card->priv->profiles != NULL, FALSE); + if (g_strcmp0 (card->priv->profile, profile) == 0) + return TRUE; + g_free (card->priv->profile); card->priv->profile = g_strdup (profile);