From 69238c119722fe1b5e1114edf3c21b2ed913feee Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 7 Mar 2023 04:45:35 +0100 Subject: [PATCH 1/2] text: Don't crash when somebody drops NULL --- gtk/gtktext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 9d11aa2d2a..53335ced05 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -6354,6 +6354,9 @@ gtk_text_drag_drop (GtkDropTarget *dest, drop_position = gtk_text_find_position (self, x + priv->scroll_offset); str = g_value_get_string (value); + if (str == NULL) + str = ""; + if (priv->truncate_multiline) length = truncate_multiline (str); else From 7fff1885578f89055e92b2b32a8530524a24baf4 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 7 Mar 2023 05:50:08 +0100 Subject: [PATCH 2/2] wayland: Don't crash during DND with Cairo renderer Attaching buffers with offsets is forbidden now and nobody checked the Cairo renderer. --- gdk/wayland/gdksurface-wayland.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 21488fc987..a76a2c7247 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -561,8 +561,14 @@ gdk_wayland_surface_attach_image (GdkSurface *surface, /* Attach this new buffer to the surface */ wl_surface_attach (impl->display_server.wl_surface, _gdk_wayland_shm_surface_get_wl_buffer (cairo_surface), - impl->pending_buffer_offset_x, - impl->pending_buffer_offset_y); + 0, 0); + + if ((impl->pending_buffer_offset_x || impl->pending_buffer_offset_y) && + wl_surface_get_version (impl->display_server.wl_surface) >= + WL_SURFACE_OFFSET_SINCE_VERSION) + wl_surface_offset (impl->display_server.wl_surface, + impl->pending_buffer_offset_x, + impl->pending_buffer_offset_y); impl->pending_buffer_offset_x = 0; impl->pending_buffer_offset_y = 0;