Add missing check for dead surfaces

Previously a pointer.leave event would be sent with a NULL target,
causing the client to disconnect.
This commit is contained in:
Demi Marie Obenour 2021-10-01 14:59:35 -04:00 committed by Victor Berger
parent fdaf1859b0
commit a9f1188fea
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ impl PointerInternal {
F: FnMut(&WlPointer, &WlSurface), F: FnMut(&WlPointer, &WlSurface),
{ {
if let Some((ref focus, _)) = self.focus { if let Some((ref focus, _)) = self.focus {
if !focus.as_ref().is_alive() {
return;
}
for ptr in &self.known_pointers { for ptr in &self.known_pointers {
if ptr.as_ref().same_client_as(focus.as_ref()) { if ptr.as_ref().same_client_as(focus.as_ref()) {
f(ptr, focus) f(ptr, focus)