fix: problem unwrap in wl_pointer::Event (again)
I triggered the unwrap in the `Motion` case while using the color picker in Krita. If you hold down the mouse such that the color comparison pop-up opens and flick to it, you can sometimes enter and motion on a stale surface. Somewhat inconsistent to trigger. I also removed the unwrap in the `Button` event since it is logically equivalent to the other unwrap. A few logging statements also got changed to give wl_surface details.
This commit is contained in:
parent
5d23452874
commit
4ea4960f5e
1 changed files with 16 additions and 7 deletions
|
|
@ -634,7 +634,7 @@ impl Event for client::wl_pointer::Event {
|
|||
.insert_one(target, CurrentSurface::Decoration(parent))
|
||||
.unwrap();
|
||||
} else {
|
||||
warn!("could not enter surface: stale surface");
|
||||
warn!("could not enter surface {}: stale surface", surface.id());
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -686,7 +686,7 @@ impl Event for client::wl_pointer::Event {
|
|||
if !surface.is_alive() {
|
||||
return;
|
||||
}
|
||||
debug!("leaving surface ({serial})");
|
||||
debug!("leaving surface ({})", surface.id());
|
||||
if let Ok(CurrentSurface::Decoration(parent)) =
|
||||
state.world.remove_one::<CurrentSurface>(target)
|
||||
{
|
||||
|
|
@ -716,7 +716,10 @@ impl Event for client::wl_pointer::Event {
|
|||
return;
|
||||
}
|
||||
{
|
||||
let surface = state.world.get::<&CurrentSurface>(target).unwrap();
|
||||
let Ok(surface) = state.world.get::<&CurrentSurface>(target) else {
|
||||
warn!("could not motion on surface: stale surface");
|
||||
return;
|
||||
};
|
||||
if let CurrentSurface::Decoration(parent) = &*surface {
|
||||
decoration::handle_pointer_motion(state, *parent, surface_x, surface_y);
|
||||
return;
|
||||
|
|
@ -745,10 +748,16 @@ impl Event for client::wl_pointer::Event {
|
|||
}
|
||||
let mut cmd = CommandBuffer::new();
|
||||
|
||||
let mut query = state
|
||||
.world
|
||||
.query_one::<(&WlPointer, &client::wl_seat::WlSeat, &CurrentSurface)>(target)
|
||||
.unwrap();
|
||||
let Ok(mut query) =
|
||||
state
|
||||
.world
|
||||
.query_one::<(&WlPointer, &client::wl_seat::WlSeat, &CurrentSurface)>(
|
||||
target,
|
||||
)
|
||||
else {
|
||||
warn!("could not click on surface: stale surface");
|
||||
return;
|
||||
};
|
||||
|
||||
let (server, seat, current_surface) = query.get().unwrap();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue