sink,source: Avoid crash by not updating volume on shutdown

Sometimes the ALSA mixer can be modified during a point at shutdown
which causes a race condition trying to update the volume of an
unlinked sink.

Includes typo fix by our Chief Typo Spotter, Colin, and a clarifying
comment by me.

BugLink: http://bugs.launchpad.net/bugs/841968
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2011-09-12 12:57:20 +02:00 committed by Arun Raghavan
parent 38be4a2d44
commit f8624a7876
4 changed files with 14 additions and 0 deletions

View file

@ -1212,6 +1212,9 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
if (mask == SND_CTL_EVENT_MASK_REMOVE)
return 0;
if (!PA_SINK_IS_LINKED(u->sink->state))
return 0;
if (u->sink->suspend_cause & PA_SUSPEND_SESSION)
return 0;