From eea0ced627947a16bc8737dbf2c5ff3e7aa3d60d Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 23 Dec 2021 18:18:32 -0500 Subject: [PATCH] [client] wayland: handle NULL wl_keyboard on destruction --- client/displayservers/Wayland/input.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/displayservers/Wayland/input.c b/client/displayservers/Wayland/input.c index df6c3390..2afa701d 100644 --- a/client/displayservers/Wayland/input.c +++ b/client/displayservers/Wayland/input.c @@ -420,7 +420,12 @@ void waylandInputFree(void) if (wlWm.pointer) waylandCleanUpPointer(); - wl_keyboard_destroy(wlWm.keyboard); + + // The only legal way the keyboard can be null is if it never existed. + // When unplugged, the compositor must have an inert object. + if (wlWm.keyboard) + wl_keyboard_destroy(wlWm.keyboard); + wl_seat_destroy(wlWm.seat); if (wlWm.xkbState)