wlroots-hyprland/xwayland
Tudor Brindus 7bb9d48dd1 xwayland: remove stale transfers from the same requestor
It seems that if we ever try to reply to a selection request after
another has been sent by the same requestor (we reply in FIFO order),
the requestor never reads from it, and we end up stalling forever on a
transfer that will never complete.

It appears that `XCB_SELECTION_REQUEST` has some sort of singleton
semantics, and new requests for the same selection are meant to replace
outstanding older ones. I couldn't find a reference for this, but
empirically this does seem to be the case.

Real (contrived) case where we don't currently do this, and things break:

* run fcitx
* run Slack
* wl-copy < <(base64 /opt/firefox/libxul.so)  # or some other large file
* focus Slack (no need to paste)

fcitx will send in an `XCB_SELECTION_REQUEST`, and we'll start
processing it. Immediately after, Slack sends its own. fcitx hangs for a
long, long time. In the meantime, Slack retries and sends another
selection request. We now have two pending requests from Slack.

Eventually fcitx gives up (or it can be `pkill`'d), and we start
processing the first request Slack gave us (FIFO). Slack (Electron?)
isn't listening on the other end anymore, and this transfer never
completes. The X11 clipboard becomes unusable until Slack is killed.

After this patch, the clipboard is immediately usable again after fcitx
bails. Also added a bunch of debug-level logging that makes diagnosing
this sort of issue easier.

Refs swaywm/sway#4007.
2020-10-12 10:53:42 +02:00
..
selection xwayland: remove stale transfers from the same requestor 2020-10-12 10:53:42 +02:00
meson.build xwayland: split server 2020-05-19 22:07:47 +02:00
server.c xwayland: introduce WLR_XWAYLAND for specifying which Xwayland to use 2020-10-11 09:00:52 +02:00
sockets.c meson: enable more compiler warnings 2019-03-01 09:20:23 +01:00
sockets.h xwayland: remove remaining SOCK_CLOEXEC 2019-02-20 17:04:00 +01:00
xwayland.c xwayland: free server in error path 2020-07-27 10:49:19 +02:00
xwm.c xwm: add loop detection for read_surface_parent 2020-10-08 19:32:58 +02:00