diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-07-16 18:52:40 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-07-16 18:52:40 +0200 |
commit | 11830871dfdc82329e39a849834450fd6946871a (patch) | |
tree | d311fb7da4341e9bdfe50d2c36d711174f99697e /src | |
parent | a54efe85814bee82a20cb53368965abfd1884a92 (diff) |
client-node: improve cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/module-client-node/client-node.c | 9 | ||||
-rw-r--r-- | src/modules/module-client-node/remote-node.c | 27 |
2 files changed, 29 insertions, 7 deletions
diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 0aa46383..b6baf020 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -1253,7 +1253,8 @@ static void client_node_resource_destroy(void *data) true, &node->data_source); } - pw_node_destroy(this->node); + if (this->node) + pw_node_destroy(this->node); } static void client_node_resource_error(void *data, int seq, int res, const char *message) @@ -1348,13 +1349,19 @@ static void node_initialized(void *data) static void node_free(void *data) { struct impl *impl = data; + struct pw_client_node *this = &impl->this; struct spa_system *data_system = impl->node.data_system; + this->node = NULL; + pw_log_debug(NAME " %p: free", &impl->this); node_clear(&impl->node); spa_hook_remove(&impl->node_listener); + if (this->resource) + pw_resource_destroy(this->resource); + pw_array_clear(&impl->mems); if (impl->io_areas) pw_memblock_free(impl->io_areas); diff --git a/src/modules/module-client-node/remote-node.c b/src/modules/module-client-node/remote-node.c index 217afc64..c4a2e3c0 100644 --- a/src/modules/module-client-node/remote-node.c +++ b/src/modules/module-client-node/remote-node.c @@ -1037,12 +1037,14 @@ static void do_node_init(struct pw_proxy *proxy) static void clear_mix(struct node_data *data, struct mix *mix) { - clear_buffers(data, mix); - pw_array_clear(&mix->buffers); - deactivate_mix(data, mix); spa_list_remove(&mix->link); + + clear_buffers(data, mix); + pw_array_clear(&mix->buffers); + + spa_list_remove(&mix->mix.link); spa_list_append(&data->free_mix, &mix->link); } @@ -1071,12 +1073,14 @@ static void node_destroy(void *data) static void node_free(void *data) { struct node_data *d = data; - struct pw_proxy *proxy = (struct pw_proxy*) d->node_proxy; pw_log_debug("%p: free", d); - pw_proxy_destroy(d->proxy); - pw_proxy_destroy(proxy); + if (d->proxy) { + pw_proxy_destroy(d->proxy); + d->proxy = NULL; + } + pw_proxy_destroy((struct pw_proxy*)d->node_proxy); } static void node_info_changed(void *data, const struct pw_node_info *info) @@ -1132,8 +1136,19 @@ static const struct pw_node_events node_events = { static void node_proxy_destroy(void *_data) { struct node_data *data = _data; + + pw_log_debug("%p: destroy", data); + clean_node(data); + spa_hook_remove(&data->node_listener); + + data->node_proxy = NULL; + + if (data->proxy) { + pw_proxy_destroy(data->proxy); + data->proxy = NULL; + } if (data->do_free) pw_node_destroy(data->node); } |