aboutsummaryrefslogtreecommitdiff
path: root/seatd/client.c
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-09-01 02:47:03 +0200
committerKenny Levinsen <kl@kl.wtf>2020-09-01 02:47:03 +0200
commitad214dc3fe6fbbf6e32532015ca54a484c5841b4 (patch)
treee85d0c91e40afd9a3248dfefe124e63dbb34ba4c /seatd/client.c
parent34d0c87ea80d06bc55ea9d28fe2f4ce0d7d816c6 (diff)
client: Only unlink if on the idle list
Diffstat (limited to 'seatd/client.c')
-rw-r--r--seatd/client.c8
1 files changed, 6 insertions, 2 deletions
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);
}