Commit e7fff215 authored by Tom Hochstein's avatar Tom Hochstein Committed by Daniel Stone

xwayland: Fix crash when run with no input device

Starting an xterm with no input device led to a crash
because weston_wm_pick_seat() was returning garbage and
weston_wm_selection_init() was trying to use the garbage.
Signed-off-by: default avatarTom Hochstein <tom.hochstein@nxp.com>
Reviewed-by: default avatarGiulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: default avatarBryce Harrington <bryce@osg.samsung.com>
parent 61beda65
......@@ -709,6 +709,8 @@ weston_wm_selection_init(struct weston_wm *wm)
wm->atom.clipboard, mask);
seat = weston_wm_pick_seat(wm);
if (seat == NULL)
return;
wm->selection_listener.notify = weston_wm_set_selection;
wl_signal_add(&seat->selection_signal, &wm->selection_listener);
......
......@@ -1306,8 +1306,10 @@ weston_wm_handle_reparent_notify(struct weston_wm *wm, xcb_generic_event_t *even
struct weston_seat *
weston_wm_pick_seat(struct weston_wm *wm)
{
return container_of(wm->server->compositor->seat_list.next,
struct weston_seat, link);
struct wl_list *seats = wm->server->compositor->seat_list.next;
if (wl_list_empty(seats))
return NULL;
return container_of(seats, struct weston_seat, link);
}
static struct weston_seat *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment