1
0
Fork 0

wayland/pointer-constraints: Warp pointer after destroying resource

e994fbf02 moved warping the pointer to before the destruction of the
resource to prevent dereferencing the constraint after destruction.
This however meant that the constraint was still active when the motion
event caused by the warp is handled, which would constrain the pointer
back again to its original position.

This moves the warping of the pointer back to after the destruction of
the resource and instead just retrieves the seat earlier while the
constraint is still valid.

Fixes: e994fbf02 ("wayland/pointer-constraints: Warp pointer before destroying resource")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3696
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4098>


(cherry picked from commit cb34fafd57)
This commit is contained in:
Sebastian Keller 2024-10-19 20:41:02 +02:00 committed by Jonas Ådahl
parent 7848c15baf
commit 5bcaa7c80b

View file

@ -938,6 +938,7 @@ locked_pointer_destroy (struct wl_client *client,
{
MetaWaylandPointerConstraint *constraint =
wl_resource_get_user_data (resource);
ClutterSeat *seat;
gboolean warp_pointer = FALSE;
int warp_x, warp_y;
@ -957,12 +958,12 @@ locked_pointer_destroy (struct wl_client *client,
warp_pointer = TRUE;
warp_x = (int) x;
warp_y = (int) y;
seat = constraint->seat->clutter_seat;
}
wl_resource_destroy (resource);
if (warp_pointer)
clutter_seat_warp_pointer (constraint->seat->clutter_seat, warp_x, warp_y);
wl_resource_destroy (resource);
clutter_seat_warp_pointer (seat, warp_x, warp_y);
}
static void