Skip to content
Commit aa507417 authored by Derek Foreman's avatar Derek Foreman Committed by Daniel Stone
Browse files

xwm: Fix pasting in some cases



I guess this reverts commit 73bdc0ce
"xwm: Fix fd leak in weston_wm_send_data()"

That commit closes the send half of a pipe in weston_wm_send_data,
claiming that it's dup()licated later, and we'll leak the fd if
we don't close it.

That may have been true at the time? But currently that fd is only
duplicated by wl_event_loop_add_fd() in its normal operation, and
closing our original before that fd handler ever fires results
in an EBADF on write, and the data never reaching its intended
destination.

Worse, by the time that handler is called there might be another
use for that fd, and we could push data into it and close it.

To provoke the problem, launch an app like FireFox over Xwayland,
cut something to the clipboard, then close the app (this is the
path where the wm has stored the clipboard contents and the
app has gone away). relaunch it and paste the clipboard content
back in. clipboard_client_data() will EBADF on write, and the
data won't be pasted.

Reported-by: default avatarHideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: default avatarDerek Foreman <derek.foreman@collabora.com>
parent 892421a9
Loading
Loading
Loading
Pipeline #600562 passed with stages
in 2 minutes and 13 seconds
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment