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 bb993df236)
This commit is contained in:
Derek Foreman 2022-12-01 15:30:40 -06:00 committed by Marius Vlad
parent ac05950098
commit f5fafa05fc
1 changed files with 6 additions and 0 deletions

View File

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