xwm: Don't crash when setting selection with no seat

It's possible to set the clipboard with no seat present - one way is to
use the RDP backend and then run 'xclip -i -selection clipboard' locally
without making an RDP connection.

Check if seat is NULL to prevent this from crashing.

Fixes #698

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
(cherry picked from commit bb993df236766178df95579217171bce5b166031)
dev
Derek Foreman 2 years ago committed by Marius Vlad
parent ac05950098
commit f5fafa05fc
  1. 6
      xwayland/selection.c

@ -199,6 +199,9 @@ weston_wm_get_selection_targets(struct weston_wm *wm)
char *logstr; char *logstr;
size_t logsize; size_t logsize;
if (!seat)
return;
cookie = xcb_get_property(wm->conn, cookie = xcb_get_property(wm->conn,
1, /* delete */ 1, /* delete */
wm->selection_window, wm->selection_window,
@ -631,6 +634,9 @@ weston_wm_handle_xfixes_selection_notify(struct weston_wm *wm,
xfixes_selection_notify->owner); xfixes_selection_notify->owner);
if (xfixes_selection_notify->owner == XCB_WINDOW_NONE) { if (xfixes_selection_notify->owner == XCB_WINDOW_NONE) {
if (!seat)
return 1;
if (wm->selection_owner != wm->selection_window) { if (wm->selection_owner != wm->selection_window) {
/* A real X client selection went away, not our /* A real X client selection went away, not our
* proxy selection. Clear the wayland selection. */ * proxy selection. Clear the wayland selection. */

Loading…
Cancel
Save