aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorTudor Brindus <me@tbrindus.ca>2021-01-29 18:24:08 -0500
committerSimon Ser <contact@emersion.fr>2021-01-31 10:24:47 +0100
commite0dfc14983c3b873f4de465bf55bdf2de0e106ba (patch)
tree4efee3d743cece6772d0f7fb71e6387a294c42c8 /xwayland
parentc89dba94353771dbfa47e2af5e8eac01ae456213 (diff)
xwayland/selection: don't request another selection while one is pending
This will hopefully be fixed in the future by having separate windows for each X11-to-Wayland transfer, but until then, let's avoid a compositor crash.
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/selection/incoming.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/xwayland/selection/incoming.c b/xwayland/selection/incoming.c
index 91ab7767..c5aa783e 100644
--- a/xwayland/selection/incoming.c
+++ b/xwayland/selection/incoming.c
@@ -150,6 +150,21 @@ static void source_send(struct wlr_xwm_selection *selection,
return;
}
+ // FIXME: we currently can't handle two X11-to-Wayland transfers at once due
+ // to reusing the same X11 window. Proceeding further here would lead us to
+ // lose track of the current `transfer->wl_client_fd` and use-after-free
+ // during cleanup. This doesn't happen often, but bail now to avoid a
+ // compositor crash later.
+ if (transfer->wl_client_fd > 0) {
+ wlr_log(WLR_ERROR, "source_send fd %d, but %d already in progress", fd,
+ transfer->wl_client_fd);
+ if (transfer->wl_client_fd != fd) {
+ close(fd);
+ }
+
+ return;
+ }
+
xcb_convert_selection(xwm->xcb_conn,
selection->window,
selection->atom,