mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: pending-sample: move reference counting
Move the reference counting from `pending_sample_free()` into `on_sample_done()` so that the client's references are managed in a single place. The reason why `pending_sample_free()` cannot simply call `client_unref()` is that `client_free()` may be called from `manager_disconnect()` regardless of the reference count, and, in turn, `pending_sample_free()` may be called, which could then lead to a recursive call to `client_free()`.
This commit is contained in:
		
							parent
							
								
									29a288ebae
								
							
						
					
					
						commit
						bc2914b3e9
					
				
					 2 changed files with 2 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -2344,9 +2344,9 @@ static void on_sample_done(void *obj, void *data, int res, uint32_t id)
 | 
			
		|||
{
 | 
			
		||||
	struct pending_sample *ps = obj;
 | 
			
		||||
	struct client *client = ps->client;
 | 
			
		||||
 | 
			
		||||
	pending_sample_free(ps);
 | 
			
		||||
	if (client->ref <= 0)
 | 
			
		||||
		client_free(client);
 | 
			
		||||
	client_unref(client);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sample_play_done(void *data, int res)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue