xwayland: Fix possible cancellation of wayland data sources

If we receive multiple SelectionRequest events, we'll end up replacing the
former WaylandSelectionData at a time when an async read has been issued.
This will cause the cancellation of the previous operation.

But the wayland_data_read() callback will attempt to just remove the
current wayland data again on error, which will not be the one we're
cancelling, so the new operation will just be cancelled too.

Also, cancellation is no longer warned about. As the wayland selection
has been replaced at this time, we can just return here.

https://bugzilla.gnome.org/show_bug.cgi?id=760745
This commit is contained in:
Carlos Garnacho 2016-03-02 16:38:20 +01:00
parent da28d7a012
commit a94e640b3f

View File

@ -672,11 +672,17 @@ wayland_data_read_cb (GObject *object,
res, &error);
if (error)
{
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
g_error_free (error);
return;
}
g_warning ("Error transfering wayland clipboard to X11: %s\n",
error->message);
g_error_free (error);
if (data)
if (data && data->stream == G_INPUT_STREAM (object))
{
reply_selection_request (&data->request_event, FALSE);
g_clear_pointer (&selection->wayland_selection,