diff options
-rw-r--r-- | src/modules/alsa/alsa-util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 7dc373fa0..f4e838d37 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -1654,7 +1654,13 @@ static int mixer_class_event(snd_mixer_class_t *class, unsigned int mask, { int err; const char *name = snd_hctl_elem_get_name(helem); - if (mask & SND_CTL_EVENT_MASK_ADD) { + /* NOTE: The remove event is defined as '~0U`. */ + if (mask == SND_CTL_EVENT_MASK_REMOVE) { + /* NOTE: Unless we remove the pointer to melem from the linked-list at + * private_data of helem, an assertion will be hit in alsa-lib since + * the list is not empty. */ + snd_mixer_elem_detach(melem, helem); + } else if (mask & SND_CTL_EVENT_MASK_ADD) { snd_ctl_elem_iface_t iface = snd_hctl_elem_get_interface(helem); if (iface == SND_CTL_ELEM_IFACE_CARD || iface == SND_CTL_ELEM_IFACE_PCM) { snd_mixer_elem_t *new_melem; |