From 47bc37c67b6202a60fb9c3cc10e7dcd73e32b92d Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Tue, 29 Jun 2021 22:27:38 +0200 Subject: [PATCH] Disable pointer grab with dead starting surface --- src/wayland/seat/pointer.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wayland/seat/pointer.rs b/src/wayland/seat/pointer.rs index 7f142b5..c6ba459 100644 --- a/src/wayland/seat/pointer.rs +++ b/src/wayland/seat/pointer.rs @@ -125,6 +125,14 @@ impl PointerInternal { match grab { GrabStatus::Borrowed => panic!("Accessed a pointer grab from within a pointer grab access."), GrabStatus::Active(_, ref mut handler) => { + // If this grab is associated with a surface that is no longer alive, discard it + if let Some((ref surface, _)) = handler.start_data().focus { + if !surface.as_ref().is_alive() { + self.grab = GrabStatus::None; + f(PointerInnerHandle { inner: self }, &mut DefaultGrab); + return; + } + } f(PointerInnerHandle { inner: self }, &mut **handler); } GrabStatus::None => {