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.
This commit is contained in:
Tanu Kaskinen 2016-12-08 01:59:03 +02:00
parent 539eb5c244
commit af45c0e3cd
2 changed files with 20 additions and 4 deletions

View file

@ -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);

View file

@ -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 */