server: Don't panic on stale wl_pointer ObjectKey

Fixes #113
This commit is contained in:
Shawn Wallace 2025-03-04 21:04:39 -05:00
parent 44590a416d
commit 10cb041a80

View file

@ -378,9 +378,11 @@ impl HandleEvent for Pointer {
surface_x,
surface_y,
} => 'enter: {
let surface_key: ObjectKey = surface.data().copied().unwrap();
let Some(surface_data): Option<&SurfaceData> =
state.objects.get(surface_key).map(|o| o.as_ref())
let Some(surface_data): Option<&SurfaceData> = surface
.data::<ObjectKey>()
.copied()
.and_then(|key| state.objects.get(key))
.map(|o| o.as_ref())
else {
warn!("could not enter surface: stale surface");
break 'enter;