mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	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:
		
							parent
							
								
									539eb5c244
								
							
						
					
					
						commit
						af45c0e3cd
					
				
					 2 changed files with 20 additions and 4 deletions
				
			
		| 
						 | 
					@ -2931,9 +2931,13 @@ void pa_sink_detach_within_thread(pa_sink *s) {
 | 
				
			||||||
    pa_sink_assert_io_context(s);
 | 
					    pa_sink_assert_io_context(s);
 | 
				
			||||||
    pa_assert(PA_SINK_IS_LINKED(s->thread_info.state));
 | 
					    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)
 | 
					        if (i->detach)
 | 
				
			||||||
            i->detach(i);
 | 
					            i->detach(i);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (s->monitor_source)
 | 
					    if (s->monitor_source)
 | 
				
			||||||
        pa_source_detach_within_thread(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_sink_assert_io_context(s);
 | 
				
			||||||
    pa_assert(PA_SINK_IS_LINKED(s->thread_info.state));
 | 
					    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)
 | 
					        if (i->attach)
 | 
				
			||||||
            i->attach(i);
 | 
					            i->attach(i);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (s->monitor_source)
 | 
					    if (s->monitor_source)
 | 
				
			||||||
        pa_source_attach_within_thread(s->monitor_source);
 | 
					        pa_source_attach_within_thread(s->monitor_source);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2288,9 +2288,13 @@ void pa_source_detach_within_thread(pa_source *s) {
 | 
				
			||||||
    pa_source_assert_io_context(s);
 | 
					    pa_source_assert_io_context(s);
 | 
				
			||||||
    pa_assert(PA_SOURCE_IS_LINKED(s->thread_info.state));
 | 
					    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)
 | 
					        if (o->detach)
 | 
				
			||||||
            o->detach(o);
 | 
					            o->detach(o);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Called from IO thread */
 | 
					/* Called from IO thread */
 | 
				
			||||||
| 
						 | 
					@ -2302,9 +2306,13 @@ void pa_source_attach_within_thread(pa_source *s) {
 | 
				
			||||||
    pa_source_assert_io_context(s);
 | 
					    pa_source_assert_io_context(s);
 | 
				
			||||||
    pa_assert(PA_SOURCE_IS_LINKED(s->thread_info.state));
 | 
					    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)
 | 
					        if (o->attach)
 | 
				
			||||||
            o->attach(o);
 | 
					            o->attach(o);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Called from IO thread */
 | 
					/* Called from IO thread */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue