aboutsummaryrefslogtreecommitdiff
path: root/util/region.c
diff options
context:
space:
mode:
authorTudor Brindus <me@tbrindus.ca>2020-10-11 21:25:26 -0400
committerSimon Ser <contact@emersion.fr>2020-10-12 10:53:42 +0200
commit7bb9d48dd1383b688c8fefbbb08c552c3cc33c18 (patch)
tree96647792ad1c5a12624f371a77090c35cb423a13 /util/region.c
parent1b0e4c7e6e0bf02b3c41962b669c00280ecc7712 (diff)
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.
Diffstat (limited to 'util/region.c')
0 files changed, 0 insertions, 0 deletions