[Wayland-bugs] [Bug 751414] File descriptor leak in gdk_wayland_selection_request_target()

gtk+ (GNOME Bugzilla) bugzilla at gnome.org
Wed Jun 24 11:20:46 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=751414

--- Comment #14 from Michael Catanzaro <mcatanzaro at gnome.org> ---
I will test your patches now.

Anyway, so now it's clear to me that GTK+ is not intended to handle the case
where another client calls wl_data_offer_receive() multiple times in a row
without reading the data.

I was doing this to handle drops in Chrome (works with drags from weston-dnd,
fails with drags from GTK+):

* foreach offered MIME type Chrome could ever possibly accept
  * call wl_data_offer_receive()
* Pass all received fds to another process via internal IPC (UNIX domain
socket)
* In the other process, read() the data from each fd

The read() currently never completes (without your patches applied; I will test
them now), presumably due to the missing cancel. (Note: I have to receive data
in each possible MIME type even if it won't be used in order to hook up to
Chrome's existing cross-platform drag-and-drop abstraction.)

To work properly with GTK+, I will need to modify my code to do the following:

* foreach offered MIME type Chrome could ever possibly accept
  * call wl_data_offer_receive()
  * Pass the received fd to the other process over internal IPC
  * In the other process, read() the data from each fd
  * Close the fd
  * Tell the original process it's safe to use wl_data_offer_receive() again

Correct?

Do you consider this a deficiency in GTK+ worth changing eventually? (But if
so, we'd need a plan to prevent the drag destination from causing clients to
use arbitrarily many fds.) Or would it be better to change the Wayland protocol
documentation to indicate that wl_data_offer_receive() should not be used
multiple times in a row without first closing the previously-received pipe?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-bugs/attachments/20150624/f4e8de07/attachment.html>


More information about the wayland-bugs mailing list