File mutter-fix-xwayland-dnd-crash.patch of Package mutter
From 3bfebad08e5f979ab9c9ba9b3de426a6bda8beb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Wed, 15 Oct 2025 10:13:57 +0200
Subject: [PATCH 1/2] xwayland: Fix guards in
meta_window_xwayland_stage_to_protocol
Fixes a mostly-harmless copy'n'paste accident in the referenced commit.
Fixes: 279169783cf1 ("window/xwayland: Use viewport scale for protocol / stage conversion")
---
src/wayland/meta-window-xwayland.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wayland/meta-window-xwayland.c b/src/wayland/meta-window-xwayland.c
index bf1071f3293..2797cf916c1 100644
--- a/src/wayland/meta-window-xwayland.c
+++ b/src/wayland/meta-window-xwayland.c
@@ -399,10 +399,10 @@ meta_window_xwayland_stage_to_protocol (MetaWindow *window,
surface = meta_window_get_wayland_surface (window);
if (surface && surface->viewport.has_dst_size)
{
- if (stage_x)
+ if (protocol_x)
scale_x /= get_viewport_scale_x (surface);
- if (stage_y)
+ if (protocol_y)
scale_y /= get_viewport_scale_y (surface);
}
--
GitLab
From 160331338ae2e29bc69898417634347cbda31f40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
Date: Wed, 15 Oct 2025 15:40:59 +0200
Subject: [PATCH 2/2] xwayland/dnd: Pass dest to
meta_x11_display_lookup_x_window
That shouldn't return NULL, and might result in better protocol_x/y for
a destination window using viewport scaling.
If meta_x11_display_lookup_x_window unexpectedly returns NULL, bail and
log a warning instead of crashing.
Suggested by
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/4400
Fixes: aa5b7e61f353 ("xwayland/dnd: Use meta_window_stage_to_protocol_point/rect")
v2:
* Use g_return_if_fail instead of falling back to
meta_xwayland_stage_to_protocol_point.
---
src/wayland/meta-xwayland-dnd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/wayland/meta-xwayland-dnd.c b/src/wayland/meta-xwayland-dnd.c
index d293e3fb957..c8d75c32a8a 100644
--- a/src/wayland/meta-xwayland-dnd.c
+++ b/src/wayland/meta-xwayland-dnd.c
@@ -348,6 +348,9 @@ xdnd_send_position (MetaXWaylandDnd *dnd,
XEvent xev = { 0 };
MetaWindow *window;
+ window = meta_x11_display_lookup_x_window (x11_display, dest);
+ g_return_if_fail (window);
+
user_action = meta_wayland_data_source_get_user_action (source);
meta_wayland_data_source_get_actions (source, &actions);
@@ -361,8 +364,6 @@ xdnd_send_position (MetaXWaylandDnd *dnd,
xev.xclient.format = 32;
xev.xclient.window = dest;
- window = meta_x11_display_lookup_x_window (x11_display,
- x11_display->selection.xwindow);
meta_window_stage_to_protocol_point (window,
x, y,
&protocol_x, &protocol_y);
--
GitLab