mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse: fix cleanup of the stream
When the pa_stream is destroyed we need to remove it from the global, if any (and not when the pw_stream is destroyed). Fixes crash in gnome-control-center when switching sinks. See #343
This commit is contained in:
		
							parent
							
								
									fc18a8ffbd
								
							
						
					
					
						commit
						71c760de14
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -56,8 +56,6 @@ static void stream_destroy(void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pa_stream *s = data;
 | 
						pa_stream *s = data;
 | 
				
			||||||
	s->stream = NULL;
 | 
						s->stream = NULL;
 | 
				
			||||||
	if (s->global)
 | 
					 | 
				
			||||||
		s->global->stream = NULL;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void stream_state_changed(void *data, enum pw_stream_state old,
 | 
					static void stream_state_changed(void *data, enum pw_stream_state old,
 | 
				
			||||||
| 
						 | 
					@ -678,10 +676,13 @@ static void stream_free(pa_stream *s)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("stream %p", s);
 | 
						pw_log_debug("stream %p", s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (s->stream) {
 | 
						if (s->stream) {
 | 
				
			||||||
		spa_hook_remove(&s->stream_listener);
 | 
							spa_hook_remove(&s->stream_listener);
 | 
				
			||||||
		pw_stream_destroy(s->stream);
 | 
							pw_stream_destroy(s->stream);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (s->global)
 | 
				
			||||||
 | 
							s->global->stream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_consume(m, &s->free, link) {
 | 
						spa_list_consume(m, &s->free, link) {
 | 
				
			||||||
		pw_log_trace("free %p", m);
 | 
							pw_log_trace("free %p", m);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue