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: Hideyuki Nagase hideyukn@microsoft.com