Fix regression causing wl-copy to trigger a crash

Resolves: RHEL-62993
This commit is contained in:
Jonas Ådahl 2024-10-18 13:43:48 +02:00
parent 6ce38be1d9
commit 50d3527be0
3 changed files with 83 additions and 3 deletions

View File

@ -0,0 +1,48 @@
From 0fe26e5b6d1e6f03a99623edf6a6f4c6caa2e142 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
Date: Tue, 15 Oct 2024 14:56:33 +0200
Subject: [PATCH 1/2] wayland/wl-shell: Make sure created window has a proper
size
The wl_shell_window construction is a bit messy, and was not properly
resizing when a window was created after a buffer was attached. This,
when the window was the dummy window in wl-paste, caused a SIGFPE as the
window was incorrectly assumed to be 0x0, i.e. size being 0.
---
src/wayland/meta-wayland-wl-shell.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/wayland/meta-wayland-wl-shell.c b/src/wayland/meta-wayland-wl-shell.c
index 964c185b23..51d88cea2b 100644
--- a/src/wayland/meta-wayland-wl-shell.c
+++ b/src/wayland/meta-wayland-wl-shell.c
@@ -481,7 +481,7 @@ sync_wl_shell_parent_relationship (MetaWaylandSurface *surface,
}
}
-static void
+static MetaWindow *
create_wl_shell_surface_window (MetaWaylandSurface *surface)
{
MetaWaylandWlShellSurface *wl_shell_surface =
@@ -513,6 +513,8 @@ create_wl_shell_surface_window (MetaWaylandSurface *surface)
if (meta_wayland_surface_get_window (child))
sync_wl_shell_parent_relationship (child, surface);
}
+
+ return window;
}
static void
@@ -597,7 +599,7 @@ wl_shell_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
* convenient for us. */
if (surface->buffer_ref->buffer && !window)
{
- create_wl_shell_surface_window (surface);
+ window = create_wl_shell_surface_window (surface);
}
else if (!surface->buffer_ref->buffer && window)
{
--
2.44.0.501.g19981daefd.dirty

View File

@ -0,0 +1,24 @@
From e434615ed1d4ba506e0282ad5cdc94303310c682 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
Date: Wed, 16 Oct 2024 14:26:28 +0200
Subject: [PATCH 2/2] window: Avoid SIGFPE on bogus window size
---
src/core/window.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/core/window.c b/src/core/window.c
index 512ef9312f..142aa0eca1 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2393,6 +2393,7 @@ window_would_mostly_be_covered_by_always_above_window (MetaWindow *window)
}
window_area = window->rect.width * window->rect.height;
+ g_return_val_if_fail (window_area > 0, FALSE);
cairo_region_intersect_rectangle (region, &window->rect);
intersection_area = calculate_region_area (region);
--
2.44.0.501.g19981daefd.dirty

View File

@ -10,7 +10,7 @@
Name: mutter Name: mutter
Version: 40.9 Version: 40.9
Release: 20%{?dist} Release: 21%{?dist}
Summary: Window and compositing manager based on Clutter Summary: Window and compositing manager based on Clutter
License: GPLv2+ License: GPLv2+
@ -135,6 +135,10 @@ Patch57: 0001-cursor-renderer-native-Don-t-retry-forever-after-GBM.patch
# RHEL-45998 & RHEL-45366 # RHEL-45998 & RHEL-45366
Patch58: sticky-or-on-top-dialog-fixes.patch Patch58: sticky-or-on-top-dialog-fixes.patch
# RHEL-62988
Patch59: 0001-wayland-wl-shell-Make-sure-created-window-has-a-prop.patch
Patch60: 0002-window-Avoid-SIGFPE-on-bogus-window-size.patch
BuildRequires: chrpath BuildRequires: chrpath
BuildRequires: pango-devel BuildRequires: pango-devel
BuildRequires: startup-notification-devel BuildRequires: startup-notification-devel
@ -282,13 +286,17 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests %{_datadir}/mutter-%{mutter_api_version}/tests
%changelog %changelog
* Mon Aug 05 2024 Jonas Ådahl <jadahl@redhat.com>) - 40.9-20 * Fri Oct 18 2024 Jonas Ådahl <jadahl@redhat.com> - 40.9-21
- Fix regression causing wl-copy to trigger a crash
Resolves: RHEL-62993
* Mon Aug 05 2024 Jonas Ådahl <jadahl@redhat.com> - 40.9-20
- Fix positioning when using always-on-top windows - Fix positioning when using always-on-top windows
Resolves: RHEL-45998 Resolves: RHEL-45998
- Improve handling of always-on-visible-workspace windows - Improve handling of always-on-visible-workspace windows
Resolves: RHEL-45366 Resolves: RHEL-45366
* Mon Aug 05 2024 Jonas Ådahl <jadahl@redhat.com>) - 40.9-19 * Mon Aug 05 2024 Jonas Ådahl <jadahl@redhat.com> - 40.9-19
- Don't retry using cursor plane if it failed - Don't retry using cursor plane if it failed
Resolves: RHEL-32622 Resolves: RHEL-32622