Keyboard: don't crash when coming from a different tty
It didn't occur to me that this is a completely valid case when a key release event is received even though there was no press event known to river. (I've also just had this same crash on something else, but i don't understand what the cause could be.)
This commit is contained in:
		| @ -177,7 +177,10 @@ fn handleKey(listener: *wl.Listener(*wlr.Keyboard.event.Key), event: *wlr.Keyboa | ||||
|  | ||||
|     const consumer: KeyConsumer = blk: { | ||||
|         // Decision is made on press; release only follows it | ||||
|         if (released) break :blk self.pressed.remove(event.keycode).?; | ||||
|         if (released) break :blk self.pressed.remove(event.keycode) orelse { | ||||
|             // This can happen for example when switching from a different tty | ||||
|             return; | ||||
|         }; | ||||
|  | ||||
|         if (self.device.seat.hasMapping(keycode, modifiers, released, xkb_state)) { | ||||
|             // The key must be added to the set of pressed keys with the correct consumer before | ||||
|  | ||||
		Reference in New Issue
	
	Block a user