macos: Fix clipboard data size handling
authorMatthias Clasen <mclasen@redhat.com>
Mon, 17 Oct 2022 03:45:28 +0000 (23:45 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 17 Oct 2022 03:45:28 +0000 (23:45 -0400)
We were using the allocated memory size, not
the amount of data that has been written.

Fixes: #5261
gdk/macos/gdkmacosclipboard.c

index 25f4669efb386943245f1b48de64d83bef12f74f..3a2667c0dfbbceffe883dbfe92b3240b4fea490b 100644 (file)
@@ -440,7 +440,7 @@ on_data_ready_cb (GObject      *object,
 
       g_output_stream_close (G_OUTPUT_STREAM (wr->stream), NULL, NULL);
 
-      size = g_memory_output_stream_get_size (wr->stream);
+      size = g_memory_output_stream_get_data_size (wr->stream);
       bytes = g_memory_output_stream_steal_data (wr->stream);
       data = [[NSData alloc] initWithBytesNoCopy:bytes
                                           length:size