mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
module-node-factory: remove destroyed node from node list
This commit is contained in:
parent
135a0a18d8
commit
6365ea18d9
1 changed files with 14 additions and 0 deletions
|
|
@ -45,6 +45,18 @@ struct factory_data {
|
|||
struct node_data {
|
||||
struct spa_list link;
|
||||
struct pw_node *node;
|
||||
struct spa_hook node_listener;
|
||||
};
|
||||
|
||||
static void node_destroy(void *data)
|
||||
{
|
||||
struct node_data *nd = data;
|
||||
spa_list_remove(&nd->link);
|
||||
}
|
||||
|
||||
static const struct pw_node_events node_events = {
|
||||
PW_VERSION_NODE_EVENTS,
|
||||
.destroy = node_destroy,
|
||||
};
|
||||
|
||||
static void *create_object(void *_data,
|
||||
|
|
@ -88,6 +100,8 @@ static void *create_object(void *_data,
|
|||
nd->node = node;
|
||||
spa_list_append(&data->node_list, &nd->link);
|
||||
|
||||
pw_node_add_listener(node, &nd->node_listener, &node_events, nd);
|
||||
|
||||
if (resource)
|
||||
pw_global_bind(pw_node_get_global(node),
|
||||
pw_resource_get_client(resource),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue