MetaWaylandPointerConstraint: Ignore requests on defunct resource

The constraint may be destroyed before the client destroyes the
protocol object, for example if a oneshot constraint was disabled by
alt-tab. Therefore we need to NULL check the constraint in request
handlers and ignore any requests to defunct objects.
This commit is contained in:
Jonas Ådahl 2016-02-23 17:59:47 +08:00
parent 5001aa76d7
commit b01926dbfa

View File

@ -604,7 +604,7 @@ locked_pointer_set_cursor_position_hint (struct wl_client *client,
/* Ignore a set cursor hint that was already sent after the constraint /* Ignore a set cursor hint that was already sent after the constraint
* was cancelled. */ * was cancelled. */
if (!constraint->resource || constraint->resource != resource) if (!constraint || !constraint->resource || constraint->resource != resource)
return; return;
constraint->hint_set = TRUE; constraint->hint_set = TRUE;
@ -622,6 +622,9 @@ locked_pointer_set_region (struct wl_client *client,
MetaWaylandRegion *region = MetaWaylandRegion *region =
region_resource ? wl_resource_get_user_data (region_resource) : NULL; region_resource ? wl_resource_get_user_data (region_resource) : NULL;
if (!constraint)
return;
meta_wayland_pointer_constraint_set_pending_region (constraint, region); meta_wayland_pointer_constraint_set_pending_region (constraint, region);
} }
@ -735,6 +738,9 @@ confined_pointer_set_region (struct wl_client *client,
MetaWaylandRegion *region = MetaWaylandRegion *region =
region_resource ? wl_resource_get_user_data (region_resource) : NULL; region_resource ? wl_resource_get_user_data (region_resource) : NULL;
if (!constraint)
return;
meta_wayland_pointer_constraint_set_pending_region (constraint, region); meta_wayland_pointer_constraint_set_pending_region (constraint, region);
} }