From 449d98910b312172d00d98efcabc12d3d864e07f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 14 Aug 2019 12:09:49 +0200 Subject: [PATCH] proxy: remove unncessary link in remote --- src/pipewire/private.h | 3 --- src/pipewire/proxy.c | 4 ---- src/pipewire/remote.c | 12 ++++++++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 2f993dc1f..27f0b3747 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -652,7 +652,6 @@ struct pw_proxy { struct spa_interface impl; /**< object implementation */ struct pw_remote *remote; /**< the owner remote of this proxy */ - struct spa_list link; /**< link in the remote */ uint32_t id; /**< client side id */ unsigned int zombie:1; /**< proxy is removed locally and waiting to @@ -683,9 +682,7 @@ struct pw_remote { * indexed with the client id */ struct pw_client_proxy *client_proxy; /**< proxy for the client object */ - struct spa_list proxy_list; /**< list of \ref pw_proxy objects */ struct spa_list stream_list; /**< list of \ref pw_stream objects */ - struct spa_list remote_node_list; /**< list of \ref pw_remote_node objects */ struct pw_protocol_client *conn; /**< the protocol client connection */ int recv_seq; /**< last received sequence number */ diff --git a/src/pipewire/proxy.c b/src/pipewire/proxy.c index 95788fef3..ac581fe94 100644 --- a/src/pipewire/proxy.c +++ b/src/pipewire/proxy.c @@ -96,8 +96,6 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory, this->marshal->version, this->marshal->method_marshal, this); - spa_list_append(&this->remote->proxy_list, &this->link); - pw_log_debug(NAME" %p: new %u %s remote %p, marshal %p", this, this->id, spa_debug_type_find_name(pw_type_info(), type), @@ -164,8 +162,6 @@ void pw_proxy_destroy(struct pw_proxy *proxy) if (!proxy->zombie) { pw_log_debug(NAME" %p: destroy %u", proxy, proxy->id); pw_proxy_emit_destroy(proxy); - - spa_list_remove(&proxy->link); } if (!proxy->removed) { /* if the server did not remove this proxy, remove ourselves diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c index 5192d5da5..970c707b1 100644 --- a/src/pipewire/remote.c +++ b/src/pipewire/remote.c @@ -214,7 +214,6 @@ struct pw_remote *pw_remote_new(struct pw_core *core, pw_map_init(&this->objects, 64, 32); - spa_list_init(&this->proxy_list); spa_list_init(&this->stream_list); spa_hook_list_init(&this->listener_list); @@ -465,10 +464,16 @@ int pw_remote_steal_fd(struct pw_remote *remote) return fd; } +static int destroy_proxy(void *object, void *data) +{ + if (object) + pw_proxy_destroy(object); + return 0; +} + SPA_EXPORT int pw_remote_disconnect(struct pw_remote *remote) { - struct pw_proxy *proxy; struct pw_stream *stream, *s2; pw_log_debug(NAME" %p: disconnect", remote); @@ -482,8 +487,7 @@ int pw_remote_disconnect(struct pw_remote *remote) pw_remote_update_state(remote, PW_REMOTE_STATE_UNCONNECTED, NULL); - spa_list_consume(proxy, &remote->proxy_list, link) - pw_proxy_destroy(proxy); + pw_map_for_each(&remote->objects, destroy_proxy, remote); pw_map_reset(&remote->objects);