From fec411ea5119b5f0299feb32a2d5d3887349b6d3 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 11 Aug 2026 23:31:43 +0300 Subject: [PATCH] Fix deadlock when opening screenshot UI and having a tablet --- src/niri.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/niri.rs b/src/niri.rs index 9b07e34a..b86df676 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -2008,11 +2008,15 @@ impl State { if let Some(touch) = self.niri.seat.get_touch() { touch.unset_grab(self); } - self.niri.seat.tablet_seat().with_tools(|tools| { - for tool in tools.values() { - tool.unset_grab(self, SERIAL_COUNTER.next_serial(), time); - } + + // Can't unset_grab() from with_tools(), will deadlock on tablet seat mutex... + let mut tools = Vec::new(); + self.niri.seat.tablet_seat().with_tools(|map| { + tools = Vec::from_iter(map.values().cloned()); }); + for tool in tools { + tool.unset_grab(self, SERIAL_COUNTER.next_serial(), time); + } self.backend.with_primary_renderer(|renderer| { self.niri