mir: properly handle empty clipboard

https://bugzilla.gnome.org/show_bug.cgi?id=775732
This commit is contained in:
William Hua 2017-01-09 12:04:48 -05:00
parent ea58ebe76d
commit a50a98f38b

View File

@ -743,10 +743,16 @@ gdk_mir_display_real_convert_selection (GdkDisplay *display,
paste_data = g_variant_get_fixed_array (mir_display->paste_data, &paste_size, sizeof (guchar)); paste_data = g_variant_get_fixed_array (mir_display->paste_data, &paste_size, sizeof (guchar));
paste_header = (const gint *) paste_data; paste_header = (const gint *) paste_data;
paste_formats = g_ptr_array_new_full (paste_header[0], g_free);
for (i = 0; i < paste_header[0]; i++) if (paste_data)
g_ptr_array_add (paste_formats, g_strndup (paste_data + paste_header[1 + 4 * i], paste_header[2 + 4 * i])); {
paste_formats = g_ptr_array_new_full (paste_header[0], g_free);
for (i = 0; i < paste_header[0]; i++)
g_ptr_array_add (paste_formats, g_strndup (paste_data + paste_header[1 + 4 * i], paste_header[2 + 4 * i]));
}
else
paste_formats = g_ptr_array_new_with_free_func (g_free);
if (target == gdk_atom_intern_static_string ("TARGETS")) if (target == gdk_atom_intern_static_string ("TARGETS"))
{ {