mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland: Handle wl_data_device being destroyed while focused
A wl_data_device object may be created while it is being focused, either because the client destroyed it or because the client was destroyed. Handle this by early out in focus handler vfuncs the case where it was destroyed, so that we don't corrupt memory and/or cause segmentation fault. https://bugzilla.gnome.org/show_bug.cgi?id=765062
This commit is contained in:
parent
ed5c3b39ee
commit
08ac192b9d
@ -1424,9 +1424,10 @@ meta_wayland_drag_dest_focus_out (MetaWaylandDataDevice *data_device,
|
||||
{
|
||||
MetaWaylandDragGrab *grab = data_device->current_grab;
|
||||
|
||||
if (grab->drag_focus_data_device)
|
||||
wl_data_device_send_leave (grab->drag_focus_data_device);
|
||||
if (!grab->drag_focus_data_device)
|
||||
return;
|
||||
|
||||
wl_data_device_send_leave (grab->drag_focus_data_device);
|
||||
wl_list_remove (&grab->drag_focus_listener.link);
|
||||
grab->drag_focus_data_device = NULL;
|
||||
}
|
||||
@ -1439,6 +1440,9 @@ meta_wayland_drag_dest_motion (MetaWaylandDataDevice *data_device,
|
||||
MetaWaylandDragGrab *grab = data_device->current_grab;
|
||||
wl_fixed_t sx, sy;
|
||||
|
||||
if (!grab->drag_focus_data_device)
|
||||
return;
|
||||
|
||||
meta_wayland_pointer_get_relative_coordinates (grab->generic.pointer,
|
||||
grab->drag_focus,
|
||||
&sx, &sy);
|
||||
@ -1453,6 +1457,9 @@ meta_wayland_drag_dest_drop (MetaWaylandDataDevice *data_device,
|
||||
{
|
||||
MetaWaylandDragGrab *grab = data_device->current_grab;
|
||||
|
||||
if (!grab->drag_focus_data_device)
|
||||
return;
|
||||
|
||||
wl_data_device_send_drop (grab->drag_focus_data_device);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user