gpui: Fix division by zero when chars/sec = 0 on Wayland (#44151)

Closes #44148

the existing rate == 0 check inside the timer callback already handles
disabling repeat - it just drops the timer immediately. So the fix
prevents the crash while preserving correct behavior. 

Release Notes:

- Linux (Wayland): Fixed a crash that could occur when
`characters_per_second` was zero
This commit is contained in:
Rawand Ahmed Shaswar
2025-12-04 11:26:17 -03:00
committed by GitHub
parent 4c51fffbb5
commit 2dad46c5c0
@@ -1419,7 +1419,7 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientStatePtr {
state.repeat.current_keycode = Some(keycode);
let rate = state.repeat.characters_per_second;
let repeat_interval = Duration::from_secs(1) / rate;
let repeat_interval = Duration::from_secs(1) / rate.max(1);
let id = state.repeat.current_id;
state
.loop_handle