From b01926dbfa234ac9e4a51bc8ad7aa12033cc8055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 23 Feb 2016 17:59:47 +0800 Subject: [PATCH] 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. --- src/wayland/meta-wayland-pointer-constraints.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c index 841f7d81d..5c69e70e8 100644 --- a/src/wayland/meta-wayland-pointer-constraints.c +++ b/src/wayland/meta-wayland-pointer-constraints.c @@ -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 * was cancelled. */ - if (!constraint->resource || constraint->resource != resource) + if (!constraint || !constraint->resource || constraint->resource != resource) return; constraint->hint_set = TRUE; @@ -622,6 +622,9 @@ locked_pointer_set_region (struct wl_client *client, MetaWaylandRegion *region = region_resource ? wl_resource_get_user_data (region_resource) : NULL; + if (!constraint) + return; + meta_wayland_pointer_constraint_set_pending_region (constraint, region); } @@ -735,6 +738,9 @@ confined_pointer_set_region (struct wl_client *client, MetaWaylandRegion *region = region_resource ? wl_resource_get_user_data (region_resource) : NULL; + if (!constraint) + return; + meta_wayland_pointer_constraint_set_pending_region (constraint, region); }