From f5fafa05fcf582530f58d2aabdae1a4c6cf64083 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 1 Dec 2022 15:30:40 -0600 Subject: [PATCH] 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 (cherry picked from commit bb993df236766178df95579217171bce5b166031) --- xwayland/selection.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xwayland/selection.c b/xwayland/selection.c index 0e4120ac..e12d2acf 100644 --- a/xwayland/selection.c +++ b/xwayland/selection.c @@ -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. */