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>
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;
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;
/* This message is sent from IO-thread and handled in main thread. */
pa_assert_ctl_context();
+ /* Make sure we're not messing with main thread when no longer linked */
+ if (!PA_SINK_IS_LINKED(s->state))
+ return 0;
+
pa_sink_get_volume(s, TRUE);
pa_sink_get_mute(s, TRUE);
return 0;
/* This message is sent from IO-thread and handled in main thread. */
pa_assert_ctl_context();
+ /* Make sure we're not messing with main thread when no longer linked */
+ if (!PA_SOURCE_IS_LINKED(s->state))
+ return 0;
+
pa_source_get_volume(s, TRUE);
pa_source_get_mute(s, TRUE);
return 0;