mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 20:30:04 +01:00
evdev: Log bug when releasing key with count 0
libinput keeps an internal key count. It is increased by 1 when the key is pressed and decreased by one when the key is released. The count should never be negative, however a user found an issue while running Sway and hit an assert. Replace the assert with a log to avoid the crash. Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/928 Signed-off-by: José Expósito <jose.exposito89@gmail.com>
This commit is contained in:
parent
17e556503d
commit
bb1e4a493f
1 changed files with 8 additions and 2 deletions
10
src/evdev.c
10
src/evdev.c
|
|
@ -135,8 +135,14 @@ evdev_update_key_down_count(struct evdev_device *device,
|
|||
if (pressed) {
|
||||
key_count = ++device->key_count[code];
|
||||
} else {
|
||||
assert(device->key_count[code] > 0);
|
||||
key_count = --device->key_count[code];
|
||||
if (device->key_count[code] > 0) {
|
||||
key_count = --device->key_count[code];
|
||||
} else {
|
||||
evdev_log_bug_libinput(device,
|
||||
"releasing key %s with count %d\n",
|
||||
libevdev_event_code_get_name(EV_KEY, code),
|
||||
device->key_count[code]);
|
||||
}
|
||||
}
|
||||
|
||||
if (key_count > 32) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue