aboutsummaryrefslogtreecommitdiff
path: root/xwayland/selection
diff options
context:
space:
mode:
authorTudor Brindus <me@tbrindus.ca>2021-01-29 18:30:17 -0500
committerSimon Ser <contact@emersion.fr>2021-01-31 10:24:53 +0100
commit3417fc0cca8d392d0154012b3fd8149e71f25c6d (patch)
tree712b0fc38dad9d01ff81d442da5866abaaf795a5 /xwayland/selection
parente0dfc14983c3b873f4de465bf55bdf2de0e106ba (diff)
xwayland/selection: don't leak Wayland fd if ConvertSelection fails
If our ConvertSelection failed, we would previously leak the pending Wayland client fd. Refs swaywm/sway#5946.
Diffstat (limited to 'xwayland/selection')
-rw-r--r--xwayland/selection/incoming.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xwayland/selection/incoming.c b/xwayland/selection/incoming.c
index c5aa783e..e41d1287 100644
--- a/xwayland/selection/incoming.c
+++ b/xwayland/selection/incoming.c
@@ -397,11 +397,14 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm,
if (event->property == XCB_ATOM_NONE) {
wlr_log(WLR_ERROR, "convert selection failed");
+ xwm_selection_transfer_finish(&selection->incoming);
} else if (event->target == xwm->atoms[TARGETS]) {
// No xwayland surface focused, deny access to clipboard
if (xwm->focus_surface == NULL) {
wlr_log(WLR_DEBUG, "denying write access to clipboard: "
"no xwayland surface focused");
+ // Would leak this transfer otherwise. Should never happen.
+ assert(selection->incoming.wl_client_fd <= 0);
return;
}