xwm: Propagate selection ownership immediately

If we don't xcb_flush() when we set the selection owner, we end up with
a ridiculous corner case where we can run use a command line X client
like 'xclip -i -selection clipboard' to crash weston.

Start weston, ensure Xwayland is running (set a selection with xclip), set
the clipboard from a wayland client, then set the clipboard with xclip
again.

Since xclip doesn't do anything xwm notices except set the clipboard, it
won't provoke a flush on our selection ownership change. xclip will take
ownership, then we call xcb_convert_selection(), and THEN we flush, sending
out our pending ownership change and the xcb_convert_selection() request.

The ownership change takes place first, we attempt to get our own selection
and weston explodes in a mess.

Stop this from happening with a flush when changing selection ownership.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-12-01 15:38:24 -06:00 committed by Marius Vlad
parent bb993df236
commit 11bcad116f

View File

@ -720,6 +720,8 @@ weston_wm_set_selection(struct wl_listener *listener, void *data)
wm->selection_window,
wm->atom.clipboard,
XCB_TIME_CURRENT_TIME);
xcb_flush(wm->conn);
}
static void