mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
wayland: Be more careful with mimetypes
Sometimes, jokers send us 'mimetypes' like DELETE or org.webkitgtk.WebKit.custom-pasteboard-data, and gdk_intern_mime_type will return NULL for such things. Handle that by just closing the fd. Better than running into an assertion further down.
This commit is contained in:
parent
cc867eeccf
commit
b623b2acef
@ -110,6 +110,12 @@ gdk_wayland_clipboard_data_source_send (void *data,
|
||||
source, mime_type, fd);
|
||||
|
||||
mime_type = gdk_intern_mime_type (mime_type);
|
||||
if (!mime_type)
|
||||
{
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
|
||||
gdk_clipboard_write_async (GDK_CLIPBOARD (cb),
|
||||
|
@ -250,8 +250,13 @@ data_source_send (void *data,
|
||||
"%p: data source send request for %s on fd %d\n",
|
||||
source, mime_type, fd);
|
||||
|
||||
//mime_type = gdk_intern_mime_type (mime_type);
|
||||
mime_type = g_intern_string (mime_type);
|
||||
mime_type = gdk_intern_mime_type (mime_type);
|
||||
if (!mime_type)
|
||||
{
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
|
||||
gdk_drag_write_async (drag,
|
||||
|
@ -227,6 +227,12 @@ gdk_wayland_primary_data_source_send (void *da
|
||||
source, mime_type, fd);
|
||||
|
||||
mime_type = gdk_intern_mime_type (mime_type);
|
||||
if (!mime_type)
|
||||
{
|
||||
close (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
|
||||
gdk_clipboard_write_async (GDK_CLIPBOARD (cb),
|
||||
|
Loading…
Reference in New Issue
Block a user