From d25175b91ca92f65a5628e7757b759b4052b495c Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Mon, 5 Apr 2021 00:51:52 +0200 Subject: [PATCH] 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: --- 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 e8d782047..74552679f 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);