From f8863113535c53fa6afe314b643676460273759b Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Tue, 2 Nov 2021 13:41:30 +0200 Subject: [PATCH] kiosk-shell: ignore additional seats As kiosk-shell can't cope with multiple seat add a warning and avoid creating any new seats. With it, this guards against potentially receiving an invalid seat. Signed-off-by: Marius Vlad --- kiosk-shell/kiosk-shell.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c index eed0f0aa..f95166c7 100644 --- a/kiosk-shell/kiosk-shell.c +++ b/kiosk-shell/kiosk-shell.c @@ -57,9 +57,14 @@ get_kiosk_shell_seat(struct weston_seat *seat) { struct wl_listener *listener; + if (!seat) + return NULL; + listener = wl_signal_get(&seat->destroy_signal, kiosk_shell_seat_handle_destroy); - assert(listener != NULL); + + if (!listener) + return NULL; return container_of(listener, struct kiosk_shell_seat, seat_destroy_listener); @@ -443,6 +448,12 @@ kiosk_shell_seat_create(struct kiosk_shell *shell, struct weston_seat *seat) { struct kiosk_shell_seat *shseat; + if (wl_list_length(&shell->seat_list) > 0) { + weston_log("WARNING: multiple seats detected. kiosk-shell " + "can not handle multiple seats!\n"); + return NULL; + } + shseat = zalloc(sizeof *shseat); if (!shseat) { weston_log("no memory to allocate shell seat\n");