[mutter] data-device: Protect against destroyed dnd-focus clients



commit ea4979e18281ba9abdc5f551c59ddac9852c76fa
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jun 29 16:17:38 2015 +0200

    data-device: Protect against destroyed dnd-focus clients
    
    When a possible drag dest client crashes during DnD, it may happen
    we receive first the destroy notification for the data_device, and
    later the notification for the focus surface. When this happens we
    unset the drag_focus_data_device first, and later on
    meta_wayland_drag_grab_set_focus(grab, NULL) we assume it still
    exists when sending the leave event, leading to mutter crashing
    right after.
    
    So, as we don't receive any ordering guarantees about resource
    destruction, just prepare the meta_wayland_drag_grab_set_focus()
    paths for this.

 src/wayland/meta-wayland-data-device.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 6bcf0e1..5e5d0be 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -543,6 +543,9 @@ meta_wayland_drag_dest_focus_in (MetaWaylandDataDevice *data_device,
   struct wl_client *client;
   wl_fixed_t sx, sy;
 
+  if (!grab->drag_focus_data_device)
+    return;
+
   client = wl_resource_get_client (surface->resource);
   display = wl_client_get_display (client);
 
@@ -563,7 +566,8 @@ meta_wayland_drag_dest_focus_out (MetaWaylandDataDevice *data_device,
 {
   MetaWaylandDragGrab *grab = data_device->current_grab;
 
-  wl_data_device_send_leave (grab->drag_focus_data_device);
+  if (grab->drag_focus_data_device)
+    wl_data_device_send_leave (grab->drag_focus_data_device);
 
   wl_list_remove (&grab->drag_focus_listener.link);
   grab->drag_focus_data_device = NULL;


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