Fix deadlock when opening screenshot UI and having a tablet
Browse files at this commitfec411ea5119b5f0299feb32a2d5d3887349b6d3Parent: aac15511 changed file +8 -4
- src/niri.rs +8 -4
src/niri.rsmodified+8 -4
| @@ -2008,11 +2008,15 @@ impl State { | |||
| 2008 | if let Some(touch) = self.niri.seat.get_touch() { | 2008 | if let Some(touch) = self.niri.seat.get_touch() { |
| 2009 | touch.unset_grab(self); | 2009 | touch.unset_grab(self); |
| 2010 | } | 2010 | } |
| 2011 | - self.niri.seat.tablet_seat().with_tools(|tools| { | 2011 | + |
| 2012 | - for tool in tools.values() { | 2012 | + // Can't unset_grab() from with_tools(), will deadlock on tablet seat mutex... |
| 2013 | - tool.unset_grab(self, SERIAL_COUNTER.next_serial(), time); | 2013 | + let mut tools = Vec::new(); |
| 2014 | - } | 2014 | + self.niri.seat.tablet_seat().with_tools(|map| { |
| 2015 | + tools = Vec::from_iter(map.values().cloned()); | ||
| 2015 | }); | 2016 | }); |
| 2017 | + for tool in tools { | ||
| 2018 | + tool.unset_grab(self, SERIAL_COUNTER.next_serial(), time); | ||
| 2019 | + } | ||
| 2016 | 2020 | ||
| 2017 | self.backend.with_primary_renderer(|renderer| { | 2021 | self.backend.with_primary_renderer(|renderer| { |
| 2018 | self.niri | 2022 | self.niri |