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