[mutter/wayland] wayland-pointer: Fix infinite loop when leaving focus from a destroyed surface



commit 10fead9ba14e9212aba187ff2fa4bd41e1fff9bd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jan 31 18:18:59 2014 -0500

    wayland-pointer: Fix infinite loop when leaving focus from a destroyed surface
    
    To prevent corruption, our focus listener needs to be removed even when
    the surface is destroyed. So, bailing out when pointer->focus->resource
    is NULL just isn't good enough.

 src/wayland/meta-wayland-pointer.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 193cd4d..ca65ece 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -322,12 +322,16 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
     return;
 
   resource = pointer->focus_resource;
-  if (resource && pointer->focus->resource)
+  if (resource)
     {
-      struct wl_client *client = wl_resource_get_client (resource);
-      struct wl_display *display = wl_client_get_display (client);
-      serial = wl_display_next_serial (display);
-      wl_pointer_send_leave (resource, serial, pointer->focus->resource);
+      if (pointer->focus->resource)
+        {
+          struct wl_client *client = wl_resource_get_client (resource);
+          struct wl_display *display = wl_client_get_display (client);
+          serial = wl_display_next_serial (display);
+          wl_pointer_send_leave (resource, serial, pointer->focus->resource);
+        }
+
       wl_list_remove (&pointer->focus_listener.link);
     }
 


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