mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	client-stream: improve cleanup
This commit is contained in:
		
							parent
							
								
									4d99bf9297
								
							
						
					
					
						commit
						743874dd9f
					
				
					 2 changed files with 16 additions and 5 deletions
				
			
		| 
						 | 
					@ -1122,6 +1122,7 @@ static void client_node_destroy(void *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_hook_remove(&impl->node_listener);
 | 
						spa_hook_remove(&impl->node_listener);
 | 
				
			||||||
	pw_node_destroy(impl->this.node);
 | 
						pw_node_destroy(impl->this.node);
 | 
				
			||||||
 | 
						impl->this.node = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void client_node_free(void *data)
 | 
					static void client_node_free(void *data)
 | 
				
			||||||
| 
						 | 
					@ -1155,6 +1156,7 @@ static void client_node_info_changed(void *data, const struct pw_node_info *info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("client-stream %p: info changed", this);
 | 
						pw_log_debug("client-stream %p: info changed", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (this->node)
 | 
				
			||||||
		pw_node_update_properties(this->node, info->props);
 | 
							pw_node_update_properties(this->node, info->props);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1309,4 +1311,5 @@ void pw_client_stream_destroy(struct pw_client_stream *stream)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = SPA_CONTAINER_OF(stream, struct impl, this);
 | 
						struct impl *impl = SPA_CONTAINER_OF(stream, struct impl, this);
 | 
				
			||||||
	pw_client_node_destroy(impl->client_node);
 | 
						pw_client_node_destroy(impl->client_node);
 | 
				
			||||||
 | 
						impl->client_node = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1114,16 +1114,23 @@ static void clean_node(struct node_data *d)
 | 
				
			||||||
static void node_destroy(void *data)
 | 
					static void node_destroy(void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct node_data *d = data;
 | 
						struct node_data *d = data;
 | 
				
			||||||
	struct pw_remote *remote = d->remote;
 | 
					 | 
				
			||||||
	struct pw_proxy *proxy = (struct pw_proxy*) d->node_proxy;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("%p: destroy", d);
 | 
						pw_log_debug("%p: destroy", d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						clean_node(d);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void node_free(void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct node_data *d = data;
 | 
				
			||||||
 | 
						struct pw_remote *remote = d->remote;
 | 
				
			||||||
 | 
						struct pw_proxy *proxy = (struct pw_proxy*) d->node_proxy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug("%p: free", d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (remote->core_proxy)
 | 
						if (remote->core_proxy)
 | 
				
			||||||
		pw_core_proxy_destroy(remote->core_proxy, proxy);
 | 
							pw_core_proxy_destroy(remote->core_proxy, proxy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clean_node(d);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	spa_hook_remove(&d->proxy_listener);
 | 
						spa_hook_remove(&d->proxy_listener);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1171,6 +1178,7 @@ static void node_active_changed(void *data, bool active)
 | 
				
			||||||
static const struct pw_node_events node_events = {
 | 
					static const struct pw_node_events node_events = {
 | 
				
			||||||
	PW_VERSION_NODE_EVENTS,
 | 
						PW_VERSION_NODE_EVENTS,
 | 
				
			||||||
	.destroy = node_destroy,
 | 
						.destroy = node_destroy,
 | 
				
			||||||
 | 
						.free = node_free,
 | 
				
			||||||
	.info_changed = node_info_changed,
 | 
						.info_changed = node_info_changed,
 | 
				
			||||||
	.port_info_changed = node_port_info_changed,
 | 
						.port_info_changed = node_port_info_changed,
 | 
				
			||||||
	.active_changed = node_active_changed,
 | 
						.active_changed = node_active_changed,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue