mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: improve stream cleanup
First disconnect the stream this ensures no more process events are called. Then flush out the pending events, then destroy the stream. Fixes #1451
This commit is contained in:
		
							parent
							
								
									78f52a7073
								
							
						
					
					
						commit
						9f6890e10e
					
				
					 1 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -56,17 +56,18 @@ void stream_free(struct stream *stream)
 | 
			
		|||
	if (stream->killed)
 | 
			
		||||
		stream_send_killed(stream);
 | 
			
		||||
 | 
			
		||||
	/* force processing of all pending messages before we destroy
 | 
			
		||||
	 * the stream */
 | 
			
		||||
	pw_loop_invoke(impl->loop, NULL, 0, NULL, 0, false, client);
 | 
			
		||||
 | 
			
		||||
	if (stream->channel != SPA_ID_INVALID)
 | 
			
		||||
		pw_map_remove(&client->streams, stream->channel);
 | 
			
		||||
 | 
			
		||||
	if (stream->stream) {
 | 
			
		||||
		spa_hook_remove(&stream->stream_listener);
 | 
			
		||||
		pw_stream_disconnect(stream->stream);
 | 
			
		||||
 | 
			
		||||
		/* force processing of all pending messages before we destroy
 | 
			
		||||
		 * the stream */
 | 
			
		||||
		pw_loop_invoke(impl->loop, NULL, 0, NULL, 0, false, client);
 | 
			
		||||
 | 
			
		||||
		pw_stream_destroy(stream->stream);
 | 
			
		||||
	}
 | 
			
		||||
	if (stream->channel != SPA_ID_INVALID)
 | 
			
		||||
		pw_map_remove(&client->streams, stream->channel);
 | 
			
		||||
 | 
			
		||||
	pw_work_queue_cancel(impl->work_queue, stream, SPA_ID_INVALID);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue