mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	pulsecore: Don't allow unreferencing linked object.
Sink(-input) and source(-output) called unlink function when reference count dropped to zero. This would result in unlink hooks being called with an object having a reference count of zero, and this is not a situation we want modules to have to deal with. It is better to just remove the redundant unlinking code from sink(-input) and source(-output) and assert on reference count in unlink functions as well. It is expected that in well behaving code the owner of an object will always unlink the object before unreferencing. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
This commit is contained in:
		
							parent
							
								
									be4619e3f7
								
							
						
					
					
						commit
						a5f71d1c54
					
				
					 4 changed files with 9 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -669,7 +669,7 @@ void pa_sink_unlink(pa_sink* s) {
 | 
			
		|||
    bool linked;
 | 
			
		||||
    pa_sink_input *i, PA_UNUSED *j = NULL;
 | 
			
		||||
 | 
			
		||||
    pa_assert(s);
 | 
			
		||||
    pa_sink_assert_ref(s);
 | 
			
		||||
    pa_assert_ctl_context();
 | 
			
		||||
 | 
			
		||||
    /* Please note that pa_sink_unlink() does more than simply
 | 
			
		||||
| 
						 | 
				
			
			@ -722,9 +722,7 @@ static void sink_free(pa_object *o) {
 | 
			
		|||
    pa_assert(s);
 | 
			
		||||
    pa_assert_ctl_context();
 | 
			
		||||
    pa_assert(pa_sink_refcnt(s) == 0);
 | 
			
		||||
 | 
			
		||||
    if (PA_SINK_IS_LINKED(s->state))
 | 
			
		||||
        pa_sink_unlink(s);
 | 
			
		||||
    pa_assert(!PA_SINK_IS_LINKED(s->state));
 | 
			
		||||
 | 
			
		||||
    pa_log_info("Freeing sink %u \"%s\"", s->index, s->name);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue