aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xwayland/selection/outgoing.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/xwayland/selection/outgoing.c b/xwayland/selection/outgoing.c
index 7c5c5f40..87c0fb06 100644
--- a/xwayland/selection/outgoing.c
+++ b/xwayland/selection/outgoing.c
@@ -392,9 +392,22 @@ void xwm_handle_selection_request(struct wlr_xwm *xwm,
goto fail_notify_requestor;
}
+ if (req->requestor == selection->window) {
+ wlr_log(WLR_ERROR, "selection request should have been caught before");
+ goto fail_notify_requestor;
+ }
+
if (selection->window != req->owner) {
+ if (req->time != XCB_CURRENT_TIME && req->time < selection->timestamp) {
+ wlr_log(WLR_DEBUG, "ignored old request from timestamp %d; expected > %d",
+ req->time, selection->timestamp);
+ goto fail_notify_requestor;
+ }
+
wlr_log(WLR_DEBUG, "received selection request with invalid owner");
- goto fail_notify_requestor;
+ // Don't fail (`goto fail_notify_requestor`) the selection request if we're
+ // no longer the selection owner.
+ return;
}
// No xwayland surface focused, deny access to clipboard