[mutter] MetaWaylandPointerConstraint: Ignore requests on defunct resource



commit b01926dbfa234ac9e4a51bc8ad7aa12033cc8055
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Feb 23 17:59:47 2016 +0800

    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 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index 841f7d8..5c69e70 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);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]