summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/alsa/alsa-sink.c3
-rw-r--r--src/modules/alsa/alsa-source.c3
-rw-r--r--src/pulsecore/sink.c4
-rw-r--r--src/pulsecore/source.c4
4 files changed, 14 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;
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index a29d61db1..d97fb7eec 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -2623,6 +2623,10 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
/* 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;
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 5f57265c8..0282828f8 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -2045,6 +2045,10 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_
/* 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;