From 44de3063ee30ba704592fd6c06db62639292f9f2 Mon Sep 17 00:00:00 2001 From: Tom Grushka Date: Thu, 23 Jul 2026 22:43:56 -0600 Subject: [PATCH] dbus: Fix deadlock in a11y keyboard monitor A11yKeyboardMonitorState::key_event calls self.has_key_grab() inside self.clients guard loop. A "well-behaved" a11y client calls `WatchKeyboard` before `SetKeyGrabs`. If WatchKeyboard is not called first, the `!client.watched` guard does not short-circuit, so `has_key_grab()` runs and locks `self.clients` again. This causes a deadlock and the compositor freezes, requiring a hard reboot. This commit moves the `self.has_key_grab()` before the guard to prevent a double lock. --- src/dbus/a11y_keyboard_monitor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dbus/a11y_keyboard_monitor.rs b/src/dbus/a11y_keyboard_monitor.rs index cf66a54b..c97aa590 100644 --- a/src/dbus/a11y_keyboard_monitor.rs +++ b/src/dbus/a11y_keyboard_monitor.rs @@ -150,9 +150,10 @@ impl A11yKeyboardMonitorState { } pub fn key_event(&self, modifiers: &ModifiersState, keysym: &KeysymHandle, state: KeyState) { + let has_key_grab = self.has_key_grab(modifiers, keysym.modified_sym()); let clients = self.clients.lock().unwrap(); for (unique_name, client) in clients.0.iter() { - if !client.watched && !self.has_key_grab(modifiers, keysym.modified_sym()) { + if !client.watched && !has_key_grab { continue; }