diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2016-12-08 01:59:03 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2016-12-20 01:35:58 +0200 |
commit | af45c0e3cd5808aac712836e58a8e65189aa60a1 (patch) | |
tree | ac3d2926acae60490649fdef39925c883143a8a1 /src/pulsecore | |
parent | 539eb5c24418e3e473656da2f8ea5727754da037 (diff) |
sink, source: add missing stream "attached" flag handling
The functions that call attach()/detach() for all streams on a sink or
source didn't update the "attached" flag accordingly. Since the flag is
only used in assertions, this omission didn't cause any harm in normal
use.
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/sink.c | 12 | ||||
-rw-r--r-- | src/pulsecore/source.c | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 3a2dd6c8..475e03bd 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -2931,9 +2931,13 @@ void pa_sink_detach_within_thread(pa_sink *s) { pa_sink_assert_io_context(s); pa_assert(PA_SINK_IS_LINKED(s->thread_info.state)); - PA_HASHMAP_FOREACH(i, s->thread_info.inputs, state) + PA_HASHMAP_FOREACH(i, s->thread_info.inputs, state) { + pa_assert(i->thread_info.attached); + i->thread_info.attached = false; + if (i->detach) i->detach(i); + } if (s->monitor_source) pa_source_detach_within_thread(s->monitor_source); @@ -2948,9 +2952,13 @@ void pa_sink_attach_within_thread(pa_sink *s) { pa_sink_assert_io_context(s); pa_assert(PA_SINK_IS_LINKED(s->thread_info.state)); - PA_HASHMAP_FOREACH(i, s->thread_info.inputs, state) + PA_HASHMAP_FOREACH(i, s->thread_info.inputs, state) { + pa_assert(!i->thread_info.attached); + i->thread_info.attached = true; + if (i->attach) i->attach(i); + } if (s->monitor_source) pa_source_attach_within_thread(s->monitor_source); diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 51b7fd9d..3c4a3cfd 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -2288,9 +2288,13 @@ void pa_source_detach_within_thread(pa_source *s) { pa_source_assert_io_context(s); pa_assert(PA_SOURCE_IS_LINKED(s->thread_info.state)); - PA_HASHMAP_FOREACH(o, s->thread_info.outputs, state) + PA_HASHMAP_FOREACH(o, s->thread_info.outputs, state) { + pa_assert(o->thread_info.attached); + o->thread_info.attached = false; + if (o->detach) o->detach(o); + } } /* Called from IO thread */ @@ -2302,9 +2306,13 @@ void pa_source_attach_within_thread(pa_source *s) { pa_source_assert_io_context(s); pa_assert(PA_SOURCE_IS_LINKED(s->thread_info.state)); - PA_HASHMAP_FOREACH(o, s->thread_info.outputs, state) + PA_HASHMAP_FOREACH(o, s->thread_info.outputs, state) { + pa_assert(!o->thread_info.attached); + o->thread_info.attached = true; + if (o->attach) o->attach(o); + } } /* Called from IO thread */ |