From 0f433da245df0acf4b83eafb036f71651a231800 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 15:04:48 +0000 Subject: [PATCH] gpui: Fix division by zero when chars/sec = 0 on Wayland (#44151) (cherry-pick to preview) (#44154) Cherry-pick of #44151 to preview ---- 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 Co-authored-by: Rawand Ahmed Shaswar --- crates/gpui/src/platform/linux/wayland/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rs index a2324648fbb332e75af7df74923806797d93a05a..2879925495e41fd37ea075f20a0de0b19625694e 100644 --- a/crates/gpui/src/platform/linux/wayland/client.rs +++ b/crates/gpui/src/platform/linux/wayland/client.rs @@ -1419,7 +1419,7 @@ impl Dispatch 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