[mutter/wip/carlosg/incr-is-fubar: 5/11] x11: Ensure flush() Flushes all output stream data
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/incr-is-fubar: 5/11] x11: Ensure flush() Flushes all output stream data
- Date: Sat, 11 Apr 2020 15:35:08 +0000 (UTC)
commit 3c01b03e42c8166e2a4eaa9d0e8e3d97d5ff974f
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Apr 11 16:59:17 2020 +0200
x11: Ensure flush() Flushes all output stream data
This seemed to work under the assumption that a flush() call can
only result in an INCR roundtrip. This is evidently not true, so
we should hold thing off until all pending data is actually flushed.
src/x11/meta-x11-selection-output-stream.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/x11/meta-x11-selection-output-stream.c b/src/x11/meta-x11-selection-output-stream.c
index 377bdb801..7ae1e1acc 100644
--- a/src/x11/meta-x11-selection-output-stream.c
+++ b/src/x11/meta-x11-selection-output-stream.c
@@ -288,12 +288,17 @@ meta_x11_selection_output_stream_invoke_flush (gpointer data)
{
MetaX11SelectionOutputStream *stream =
META_X11_SELECTION_OUTPUT_STREAM (data);
+ MetaX11SelectionOutputStreamPrivate *priv =
+ meta_x11_selection_output_stream_get_instance_private (stream);
if (meta_x11_selection_output_stream_needs_flush (stream) &&
meta_x11_selection_output_stream_can_flush (stream))
meta_x11_selection_output_stream_perform_flush (stream);
- return G_SOURCE_REMOVE;
+ if (priv->delete_pending || priv->data->len > 0)
+ return G_SOURCE_CONTINUE;
+ else
+ return G_SOURCE_REMOVE;
}
static gssize
@@ -473,10 +478,9 @@ meta_x11_selection_output_stream_flush_async (GOutputStream *output_stream
}
}
+ g_assert (priv->pending_task == NULL);
+ priv->pending_task = task;
meta_x11_selection_output_stream_perform_flush (stream);
- g_task_return_boolean (task, TRUE);
- g_object_unref (task);
- return;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]