diff options
author | David Henningsson <david.henningsson@canonical.com> | 2011-09-12 12:57:20 +0200 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2011-09-14 15:47:17 +0530 |
commit | f8624a7876444ebb5587c1f1bc821ab5c3a2b639 (patch) | |
tree | 466d74d68bb0f4be55cd12d128d300724e2bf6d5 /src/modules | |
parent | 38be4a2d440ce51750b96727b638f947f75d69b6 (diff) |
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>
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/alsa/alsa-sink.c | 3 | ||||
-rw-r--r-- | src/modules/alsa/alsa-source.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index d164128b4..5b8dd3154 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -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; diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 229edf12a..4b3c8b7a7 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -1063,6 +1063,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_SOURCE_IS_LINKED(u->source->state)) + return 0; + if (u->source->suspend_cause & PA_SUSPEND_SESSION) return 0; |