mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
protocol-simple: avoid freeing client multiple times
Ensure we only queue one cleanup operation and cancel all pending operations when we destroy the client. Fixes #1550
This commit is contained in:
parent
63ba9f98ba
commit
09a0fdcc0f
1 changed files with 7 additions and 1 deletions
|
|
@ -120,6 +120,7 @@ struct client {
|
|||
|
||||
unsigned int disconnect:1;
|
||||
unsigned int disconnecting:1;
|
||||
unsigned int cleanup:1;
|
||||
};
|
||||
|
||||
struct server {
|
||||
|
|
@ -158,6 +159,8 @@ static void client_free(struct client *client)
|
|||
|
||||
client_disconnect(client);
|
||||
|
||||
pw_work_queue_cancel(impl->work_queue, client, SPA_ID_INVALID);
|
||||
|
||||
spa_list_remove(&client->link);
|
||||
client->server->n_clients--;
|
||||
|
||||
|
|
@ -183,7 +186,10 @@ static void on_client_cleanup(void *obj, void *data, int res, uint32_t id)
|
|||
static void client_cleanup(struct client *client)
|
||||
{
|
||||
struct impl *impl = client->impl;
|
||||
if (!client->cleanup) {
|
||||
client->cleanup = true;
|
||||
pw_work_queue_add(impl->work_queue, client, 0, on_client_cleanup, impl);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue