[gtk/gtk-4-2: 75/91] clipboard: Fix reading of files
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-2: 75/91] clipboard: Fix reading of files
- Date: Tue, 4 May 2021 02:05:42 +0000 (UTC)
commit 8748d9511b7be81bc5d38757b146ad1bea3e2cb3
Author: Benjamin Otte <otte redhat com>
Date: Mon Apr 26 21:32:00 2021 +0200
clipboard: Fix reading of files
Make sure writing a terminating null byte actually works and we don't
just ignore the error message.
gdk/gdkcontentdeserializer.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkcontentdeserializer.c b/gdk/gdkcontentdeserializer.c
index e03df87d0f..39ebed9fd2 100644
--- a/gdk/gdkcontentdeserializer.c
+++ b/gdk/gdkcontentdeserializer.c
@@ -740,7 +740,8 @@ file_uri_deserializer_finish (GObject *source,
}
/* write terminating NULL */
- if (!g_output_stream_write (stream, "", 1, NULL, &error))
+ if (g_output_stream_write (stream, "", 1, NULL, &error) < 0 ||
+ !g_output_stream_close (stream, NULL, &error))
{
gdk_content_deserializer_return_error (deserializer, error);
return;
@@ -780,7 +781,7 @@ file_uri_deserializer (GdkContentDeserializer *deserializer)
g_output_stream_splice_async (output,
gdk_content_deserializer_get_input_stream (deserializer),
- G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
+ G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
gdk_content_deserializer_get_priority (deserializer),
gdk_content_deserializer_get_cancellable (deserializer),
file_uri_deserializer_finish,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]