diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c index 8e950852c..adc22b4a0 100644 --- a/spa/plugins/support/loop.c +++ b/spa/plugins/support/loop.c @@ -686,9 +686,9 @@ static int impl_clear(struct spa_handle *handle) impl = (struct impl *) handle; spa_list_for_each_safe(source, tmp, &impl->source_list, link) - loop_destroy_source(&source->source); + loop_destroy_source(&source->source); spa_list_for_each_safe(source, tmp, &impl->destroy_list, link) - free(source); + free(source); close(impl->ack_fd); close(impl->epoll_fd); diff --git a/src/modules/module-protocol-native/connection.c b/src/modules/module-protocol-native/connection.c index 84363b21e..0b367cf2c 100644 --- a/src/modules/module-protocol-native/connection.c +++ b/src/modules/module-protocol-native/connection.c @@ -137,7 +137,7 @@ static bool refill_buffer(struct pw_protocol_native_connection *conn, struct buf msg.msg_iovlen = 1; msg.msg_control = cmsgbuf; msg.msg_controllen = sizeof(cmsgbuf); - msg.msg_flags = MSG_CMSG_CLOEXEC; + msg.msg_flags = MSG_CMSG_CLOEXEC | MSG_DONTWAIT; while (true) { len = recvmsg(conn->fd, &msg, msg.msg_flags); @@ -482,7 +482,7 @@ bool pw_protocol_native_connection_flush(struct pw_protocol_native_connection *c } while (true) { - len = sendmsg(conn->fd, &msg, MSG_NOSIGNAL); + len = sendmsg(conn->fd, &msg, MSG_NOSIGNAL | MSG_DONTWAIT); if (len < 0) { if (errno == EINTR) continue; diff --git a/src/pipewire/core.c b/src/pipewire/core.c index 8554091de..6a8d412ea 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -486,13 +486,21 @@ void pw_core_destroy(struct pw_core *core) { struct pw_global *global, *t; struct pw_module *module, *tm; + struct pw_remote *remote, *tr; + struct pw_node *node, *tn; pw_log_debug("core %p: destroy", core); spa_hook_list_call(&core->listener_list, struct pw_core_events, destroy); + spa_list_for_each_safe(remote, tr, &core->remote_list, link) + pw_remote_destroy(remote); + spa_list_for_each_safe(module, tm, &core->module_list, link) pw_module_destroy(module); + spa_list_for_each_safe(node, tn, &core->node_list, link) + pw_node_destroy(node); + spa_list_for_each_safe(global, t, &core->global_list, link) pw_global_destroy(global); diff --git a/src/pipewire/pipewire.c b/src/pipewire/pipewire.c index 801731663..21a0372b6 100644 --- a/src/pipewire/pipewire.c +++ b/src/pipewire/pipewire.c @@ -201,6 +201,9 @@ void pw_init(int *argc, char **argv[]) if ((str = getenv("SPA_PLUGIN_DIR")) == NULL) str = PLUGINDIR; + if (support_info.n_support > 0) + return; + if (open_support(str, "support/libspa-support", &support_info)) configure_support(&support_info); } diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index c3f1f4d23..4c045e2f7 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -518,6 +518,8 @@ static void clean_transport(struct pw_proxy *proxy) if (data->trans == NULL) return; + unhandle_socket(proxy); + spa_list_for_each(port, &data->node->input_ports, link) { spa_graph_port_remove(&data->in_ports[port->port_id].output); spa_graph_port_remove(&data->in_ports[port->port_id].input); @@ -530,7 +532,6 @@ static void clean_transport(struct pw_proxy *proxy) free(data->in_ports); free(data->out_ports); pw_client_node_transport_destroy(data->trans); - unhandle_socket(proxy); close(data->rtwritefd); data->trans = NULL; @@ -1056,6 +1057,15 @@ static void do_node_init(struct pw_proxy *proxy) pw_client_node_proxy_done(data->node_proxy, 0, SPA_RESULT_OK); } +static void node_destroy(void *data) +{ + struct node_data *d = data; + pw_log_debug("%p: destroy", d); + pw_client_node_proxy_destroy(d->node_proxy); + pw_proxy_destroy((struct pw_proxy *)d->node_proxy); + d->node_proxy = NULL; +} + static void node_active_changed(void *data, bool active) { struct node_data *d = data; @@ -1065,6 +1075,7 @@ static void node_active_changed(void *data, bool active) static const struct pw_node_events node_events = { PW_VERSION_NODE_EVENTS, + .destroy = node_destroy, .active_changed = node_active_changed, .need_input = node_need_input, .have_output = node_have_output,