From b50482e346b87ea5544b348cc4dd5d475513097e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 20 Sep 2018 10:13:00 +0200 Subject: [PATCH] fix cleanup When the node is destroyed, remove it from the node list and mark the reference to the node gone so that when the resource is cleaned up we don't try to destroy the node again. --- src/modules/module-audio-dsp.c | 7 ++----- src/modules/module-link-factory.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/modules/module-audio-dsp.c b/src/modules/module-audio-dsp.c index ae3e8e2e4..044f8b062 100644 --- a/src/modules/module-audio-dsp.c +++ b/src/modules/module-audio-dsp.c @@ -64,12 +64,8 @@ struct node_data { static void resource_destroy(void *data) { struct node_data *nd = data; - spa_list_remove(&nd->link); - spa_hook_remove(&nd->resource_listener); - if (nd->dsp) { - spa_hook_remove(&nd->dsp_listener); + if (nd->dsp) pw_node_destroy(nd->dsp); - } } static const struct pw_resource_events resource_events = { @@ -80,6 +76,7 @@ static const struct pw_resource_events resource_events = { static void node_destroy(void *data) { struct node_data *nd = data; + spa_list_remove(&nd->link); nd->dsp = NULL; } diff --git a/src/modules/module-link-factory.c b/src/modules/module-link-factory.c index 703e09d90..fcc950fe7 100644 --- a/src/modules/module-link-factory.c +++ b/src/modules/module-link-factory.c @@ -57,12 +57,8 @@ struct link_data { static void resource_destroy(void *data) { struct link_data *ld = data; - spa_list_remove(&ld->l); - spa_hook_remove(&ld->resource_listener); - if (ld->link) { - spa_hook_remove(&ld->link_listener); + if (ld->link) pw_link_destroy(ld->link); - } } static const struct pw_resource_events resource_events = { @@ -73,6 +69,7 @@ static const struct pw_resource_events resource_events = { static void link_destroy(void *data) { struct link_data *ld = data; + spa_list_remove(&ld->l); ld->link = NULL; }