mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
textbuffer: Try harder to fix pasting
It turns out we can't just use the size returned by the memory stream as-is, since it may contain unfilled garbage at the end, which utf8 validation will choke on. So, cut it off at the first '\0' we find.
This commit is contained in:
parent
5b1b75b055
commit
3e7618fef7
@ -327,6 +327,8 @@ gtk_text_buffer_deserialize_text_plain_finish (GObject *source,
|
||||
|
||||
if (data)
|
||||
{
|
||||
if (memchr (data, '\0', size))
|
||||
size = -1;
|
||||
buffer = g_value_get_object (gdk_content_deserializer_get_value (deserializer));
|
||||
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||
gtk_text_buffer_insert (buffer, &end, data, size);
|
||||
|
Loading…
Reference in New Issue
Block a user