From 1bf00720e36e3578a52d0800a47ee61789586290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sun, 30 Jan 2022 15:44:48 +0100 Subject: [PATCH] pulse-server: do not manage client lifetime during stream cleanup A stream's lifetime is tied to that of the client, it cannot outlive the client object. Streams also do not increase the client's reference count. It is not possible for a stream to exist after the corresponding client has been destroyed. Hence it is not necessary to manage the client's reference count or lifetime in `do_destroy_stream()`. All works related to a particular stream are cancelled in `stream_free()`, which is called before the client is destroyed. --- src/modules/module-protocol-pulse/pulse-server.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 98a23ec81..55270858f 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -973,10 +973,8 @@ static void stream_control_info(void *data, uint32_t id, static void do_destroy_stream(void *obj, void *data, int res, uint32_t id) { struct stream *stream = obj; - struct client *client = stream->client; + stream_free(stream); - if (client->ref <= 0) - client_free(client); } static void stream_state_changed(void *data, enum pw_stream_state old,