mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
pointer-constraints: fix deactivating oneshot constraint on destroy
This commit is contained in:
parent
9ab87167b5
commit
e3596abc9a
2 changed files with 8 additions and 1 deletions
|
|
@ -70,6 +70,8 @@ struct wlr_pointer_constraint_v1 {
|
||||||
struct wl_listener seat_destroy;
|
struct wl_listener seat_destroy;
|
||||||
|
|
||||||
struct wlr_surface_synced synced;
|
struct wlr_surface_synced synced;
|
||||||
|
|
||||||
|
bool destroying;
|
||||||
} WLR_PRIVATE;
|
} WLR_PRIVATE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,15 @@ static void resource_destroy(struct wl_client *client,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointer_constraint_destroy(struct wlr_pointer_constraint_v1 *constraint) {
|
static void pointer_constraint_destroy(struct wlr_pointer_constraint_v1 *constraint) {
|
||||||
if (constraint == NULL) {
|
if (constraint == NULL || constraint->destroying) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calling wlr_pointer_constraint_v1_send_deactivated() for a oneshot constraint
|
||||||
|
// that is being destroyed results in another pointer_constraint_destroy() call.
|
||||||
|
// Avoid finalizing the state twice by setting a flag.
|
||||||
|
constraint->destroying = true;
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "destroying constraint %p", constraint);
|
wlr_log(WLR_DEBUG, "destroying constraint %p", constraint);
|
||||||
|
|
||||||
wl_signal_emit_mutable(&constraint->events.destroy, constraint);
|
wl_signal_emit_mutable(&constraint->events.destroy, constraint);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue