[mutter] x11: Always delete selection input stream property when flushing



commit d25175b91ca92f65a5628e7757b759b4052b495c
Author: Sebastian Keller <skeller gnome org>
Date:   Mon Apr 5 00:51:52 2021 +0200

    x11: Always delete selection input stream property when flushing
    
    This is a preparation for each input stream creating its own window. It
    moves deleting the property from meta_x11_selection_input_stream_xevent
    where it can run after the stream has been finalized to a spot where
    the stream still exists. Use an error trap in case the property was not
    set by the client, such as when the conversion failed.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1812>

 src/x11/meta-x11-selection-input-stream.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/x11/meta-x11-selection-input-stream.c b/src/x11/meta-x11-selection-input-stream.c
index e8d7820478..74552679f6 100644
--- a/src/x11/meta-x11-selection-input-stream.c
+++ b/src/x11/meta-x11-selection-input-stream.c
@@ -132,8 +132,13 @@ meta_x11_selection_input_stream_flush (MetaX11SelectionInputStream *stream)
 {
   MetaX11SelectionInputStreamPrivate *priv =
     meta_x11_selection_input_stream_get_instance_private (stream);
+  Display *xdisplay = priv->x11_display->xdisplay;
   gssize written;
 
+  meta_x11_error_trap_push (priv->x11_display);
+  XDeleteProperty (xdisplay, priv->window, priv->xproperty);
+  meta_x11_error_trap_pop (priv->x11_display);
+
   if (!meta_x11_selection_input_stream_has_data (stream))
     return;
 
@@ -428,9 +433,6 @@ meta_x11_selection_input_stream_xevent (MetaX11SelectionInputStream *stream,
           g_async_queue_push (priv->chunks, bytes);
           meta_x11_selection_input_stream_flush (stream);
         }
-
-      XDeleteProperty (xdisplay, xwindow, xevent->xproperty.atom);
-
       return FALSE;
 
     case SelectionNotify:
@@ -489,8 +491,6 @@ meta_x11_selection_input_stream_xevent (MetaX11SelectionInputStream *stream,
                     meta_x11_selection_input_stream_complete (stream);
                   }
               }
-
-            XDeleteProperty (xdisplay, xwindow, xevent->xselection.property);
           }
 
         g_object_unref (task);


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