From ad214dc3fe6fbbf6e32532015ca54a484c5841b4 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Tue, 1 Sep 2020 02:47:03 +0200 Subject: client: Only unlink if on the idle list --- seatd/client.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'seatd') diff --git a/seatd/client.c b/seatd/client.c index 8562c8b..bf339d9 100644 --- a/seatd/client.c +++ b/seatd/client.c @@ -80,8 +80,13 @@ void client_destroy(struct client *client) { client->connection.fd = -1; } if (client->seat != NULL) { - // This should also close and remove all devices + // This should also close and remove all devices. This unlinks + // the client. seat_remove_client(client); + } else { + // If we are not a member of a seat, we will be on the idle + // clients list, so unlink the client manually. + linked_list_remove(&client->link); } if (client->event_source != NULL) { event_source_fd_destroy(client->event_source); @@ -89,7 +94,6 @@ void client_destroy(struct client *client) { } connection_close_fds(&client->connection); assert(linked_list_empty(&client->devices)); - linked_list_remove(&client->link); free(client); } -- cgit v1.2.3