[mutter] xwayland: Fix possible cancellation of wayland data sources



commit a94e640b3f3aa150682692997cb303701d480307
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 2 16:38:20 2016 +0100

    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

 src/wayland/meta-xwayland-selection.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index 42354a7..7299dd1 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]