Improve cgroup app discovery and fix regression
Resolves: RHEL-62997 Resolves: RHEL-63000
This commit is contained in:
parent
50d3527be0
commit
ae0083d27e
26
0001-display-Make-cgroup-constructor-local.patch
Normal file
26
0001-display-Make-cgroup-constructor-local.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 088644fb1773b64ca45dec497589517e1774eac1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Tue, 27 Aug 2024 11:33:14 +0200
|
||||
Subject: [PATCH 1/5] display: Make cgroup constructor local
|
||||
|
||||
This silences a warning about a missing function declaration.
|
||||
---
|
||||
src/core/display.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/display.c b/src/core/display.c
|
||||
index 4c9038e627..97f591a876 100644
|
||||
--- a/src/core/display.c
|
||||
+++ b/src/core/display.c
|
||||
@@ -1619,7 +1619,7 @@ extract_app_id_from_cgroup (const char *cgroup)
|
||||
return g_steal_pointer (&app_id);
|
||||
}
|
||||
|
||||
-MetaCGroup*
|
||||
+static MetaCGroup*
|
||||
meta_cgroup_new (const char *path)
|
||||
{
|
||||
MetaCGroup *cgroup;
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
27
0002-display-Also-set-window-cgroup-on-cgroup-creation.patch
Normal file
27
0002-display-Also-set-window-cgroup-on-cgroup-creation.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 37b4b8dd63851e97b507008fe1028a259c0419c7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Tue, 27 Aug 2024 11:33:22 +0200
|
||||
Subject: [PATCH 2/5] display: Also set window cgroup on cgroup creation
|
||||
|
||||
We'd register the cgroup for a window twice, because the firs time
|
||||
didn't update the MetaWindow::cgroup pointer. This meant the cgroups
|
||||
were never removed.
|
||||
---
|
||||
src/core/display.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/core/display.c b/src/core/display.c
|
||||
index 97f591a876..e99e787fbe 100644
|
||||
--- a/src/core/display.c
|
||||
+++ b/src/core/display.c
|
||||
@@ -1704,6 +1704,7 @@ meta_display_register_cgroup (MetaDisplay *display,
|
||||
|
||||
cgroup = meta_cgroup_new (path);
|
||||
g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||
+ window->cgroup = cgroup;
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
36
0003-window-Unregister-cgroup-on-unmanage.patch
Normal file
36
0003-window-Unregister-cgroup-on-unmanage.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From dd887dcf4770309fca127217660c5142a463e2c1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||
Date: Tue, 27 Aug 2024 11:33:23 +0200
|
||||
Subject: [PATCH 3/5] window: Unregister cgroup on unmanage()
|
||||
|
||||
This means any potential reference held by gjs will not hold the cgroup
|
||||
alive longer than necessary.
|
||||
---
|
||||
src/core/window.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/window.c b/src/core/window.c
|
||||
index 142aa0eca1..272d664965 100644
|
||||
--- a/src/core/window.c
|
||||
+++ b/src/core/window.c
|
||||
@@ -339,8 +339,6 @@ meta_window_finalize (GObject *object)
|
||||
g_free (window->sm_client_id);
|
||||
g_free (window->wm_client_machine);
|
||||
|
||||
- meta_display_unregister_cgroup (window->display, window);
|
||||
-
|
||||
g_free (window->startup_id);
|
||||
g_free (window->role);
|
||||
g_free (window->res_class);
|
||||
@@ -1467,6 +1465,8 @@ meta_window_unmanage (MetaWindow *window,
|
||||
meta_verbose ("Unmanaging %s", window->desc);
|
||||
window->unmanaging = TRUE;
|
||||
|
||||
+ meta_display_unregister_cgroup (window->display, window);
|
||||
+
|
||||
g_clear_handle_id (&window->unmanage_idle_id, g_source_remove);
|
||||
|
||||
g_signal_emit (window, window_signals[UNMANAGING], 0);
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 6cdfc8abe25fccfd06cac99ae82c0f2acbbdb7c2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||
Date: Thu, 17 Oct 2024 11:49:26 +0200
|
||||
Subject: [PATCH 4/5] window: Don't use cgroup workspace if there already is
|
||||
one
|
||||
|
||||
This fixes a re-entry issue where calling 'meta_window_activate()'
|
||||
assumed it'd activate on the current workspace.
|
||||
---
|
||||
src/core/window.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/window.c b/src/core/window.c
|
||||
index 272d664965..8ad8e5c4c4 100644
|
||||
--- a/src/core/window.c
|
||||
+++ b/src/core/window.c
|
||||
@@ -3812,7 +3812,9 @@ meta_window_activate_full (MetaWindow *window,
|
||||
if (workspace == NULL)
|
||||
{
|
||||
meta_window_read_cgroup (window);
|
||||
- if (window->cgroup &&
|
||||
+ if (!window->workspace &&
|
||||
+ !window->on_all_workspaces &&
|
||||
+ window->cgroup &&
|
||||
window->cgroup->last_active_workspace != NULL &&
|
||||
!window->cgroup->has_startup_sequence &&
|
||||
(!window->cgroup->app_info ||
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
166
0005-cgroup-Get-app-info-from-gnome-shell-when-possible.patch
Normal file
166
0005-cgroup-Get-app-info-from-gnome-shell-when-possible.patch
Normal file
@ -0,0 +1,166 @@
|
||||
From 50d0355bda637a2b214e14c23e767e80066c1084 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@redhat.com>
|
||||
Date: Fri, 18 Oct 2024 13:23:01 +0200
|
||||
Subject: [PATCH 5/5] cgroup: Get app info from gnome-shell when possible
|
||||
|
||||
Using cgroups alone for getting the app-id is flawed, as there are many
|
||||
situations where the cgroup isn't set up properly, e.g. opening via
|
||||
xdg-open or equivalent. gnome-shell already has a system for associating
|
||||
windows with apps, so reuse this for the cgroup app info.
|
||||
---
|
||||
src/core/display-private.h | 2 ++
|
||||
src/core/display.c | 56 +++++++++++++++++++++++++++++++-------
|
||||
src/core/window.c | 6 ++++
|
||||
3 files changed, 54 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/core/display-private.h b/src/core/display-private.h
|
||||
index 3c7e0898bf..9836e560b3 100644
|
||||
--- a/src/core/display-private.h
|
||||
+++ b/src/core/display-private.h
|
||||
@@ -304,6 +304,8 @@ gboolean meta_cgroup_unref (MetaCGroup *cgroup);
|
||||
void meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||
MetaWorkspace *workspace,
|
||||
guint32 timestamp);
|
||||
+void meta_cgroup_update_app_info (MetaCGroup *cgroup,
|
||||
+ MetaWindow *window);
|
||||
|
||||
/* A "stack id" is a XID or a stamp */
|
||||
#define META_STACK_ID_IS_X11(id) ((id) < G_GUINT64_CONSTANT(0x100000000))
|
||||
diff --git a/src/core/display.c b/src/core/display.c
|
||||
index e99e787fbe..637bc006d8 100644
|
||||
--- a/src/core/display.c
|
||||
+++ b/src/core/display.c
|
||||
@@ -162,6 +162,7 @@ enum
|
||||
WORKAREAS_CHANGED,
|
||||
CLOSING,
|
||||
INIT_XSERVER,
|
||||
+ FIND_APP_INFO,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -515,6 +516,12 @@ meta_display_class_init (MetaDisplayClass *klass)
|
||||
0, g_signal_accumulator_first_wins,
|
||||
NULL, NULL,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_TASK);
|
||||
+ display_signals[FIND_APP_INFO] =
|
||||
+ g_signal_new ("find-app-info",
|
||||
+ G_TYPE_FROM_CLASS (klass),
|
||||
+ G_SIGNAL_RUN_LAST,
|
||||
+ 0, NULL, NULL, NULL,
|
||||
+ G_TYPE_DESKTOP_APP_INFO, 1, META_TYPE_WINDOW);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_COMPOSITOR_MODIFIERS,
|
||||
@@ -1620,25 +1627,32 @@ extract_app_id_from_cgroup (const char *cgroup)
|
||||
}
|
||||
|
||||
static MetaCGroup*
|
||||
-meta_cgroup_new (const char *path)
|
||||
+meta_cgroup_new (const char *path,
|
||||
+ GAppInfo *app_info)
|
||||
{
|
||||
MetaCGroup *cgroup;
|
||||
- g_autofree char *app_id = NULL;
|
||||
|
||||
cgroup = g_new0 (MetaCGroup, 1);
|
||||
cgroup->path = g_file_new_for_path (path);
|
||||
g_ref_count_init (&cgroup->ref_count);
|
||||
|
||||
- app_id = extract_app_id_from_cgroup (path);
|
||||
-
|
||||
- if (app_id)
|
||||
+ if (!app_info)
|
||||
{
|
||||
- g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||
+ g_autofree char *app_id = NULL;
|
||||
|
||||
- app_info = g_desktop_app_info_new (app_id);
|
||||
+ app_id = extract_app_id_from_cgroup (path);
|
||||
+ if (app_id)
|
||||
+ {
|
||||
+ GDesktopAppInfo *desktop_app_info;
|
||||
|
||||
- if (app_info)
|
||||
- cgroup->app_info = G_APP_INFO (g_steal_pointer (&app_info));
|
||||
+ desktop_app_info = g_desktop_app_info_new (app_id);
|
||||
+ if (desktop_app_info)
|
||||
+ cgroup->app_info = G_APP_INFO (desktop_app_info);
|
||||
+ }
|
||||
+ }
|
||||
+ else if (app_info)
|
||||
+ {
|
||||
+ cgroup->app_info = g_object_ref (app_info);
|
||||
}
|
||||
|
||||
return cgroup;
|
||||
@@ -1687,12 +1701,30 @@ meta_cgroup_update_workspace (MetaCGroup *cgroup,
|
||||
(gpointer *) &cgroup->last_active_workspace);
|
||||
}
|
||||
|
||||
+void
|
||||
+meta_cgroup_update_app_info (MetaCGroup *cgroup,
|
||||
+ MetaWindow *window)
|
||||
+{
|
||||
+ g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||
+
|
||||
+ g_signal_emit (window->display,
|
||||
+ display_signals[FIND_APP_INFO], 0,
|
||||
+ window, &app_info);
|
||||
+
|
||||
+ if (app_info)
|
||||
+ {
|
||||
+ g_clear_object (&cgroup->app_info);
|
||||
+ cgroup->app_info = G_APP_INFO (g_steal_pointer (&app_info));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
meta_display_register_cgroup (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
const char *path)
|
||||
{
|
||||
MetaCGroup *cgroup;
|
||||
+ g_autoptr (GDesktopAppInfo) app_info = NULL;
|
||||
|
||||
cgroup = g_hash_table_lookup (display->cgroups, path);
|
||||
|
||||
@@ -1702,7 +1734,11 @@ meta_display_register_cgroup (MetaDisplay *display,
|
||||
return;
|
||||
}
|
||||
|
||||
- cgroup = meta_cgroup_new (path);
|
||||
+ g_signal_emit (display,
|
||||
+ display_signals[FIND_APP_INFO], 0,
|
||||
+ window, &app_info);
|
||||
+
|
||||
+ cgroup = meta_cgroup_new (path, app_info ? G_APP_INFO (app_info) : NULL);
|
||||
g_hash_table_insert (display->cgroups, g_file_get_path (cgroup->path), cgroup);
|
||||
window->cgroup = cgroup;
|
||||
}
|
||||
diff --git a/src/core/window.c b/src/core/window.c
|
||||
index 8ad8e5c4c4..6de815839f 100644
|
||||
--- a/src/core/window.c
|
||||
+++ b/src/core/window.c
|
||||
@@ -8131,6 +8131,9 @@ meta_window_set_wm_class (MetaWindow *window,
|
||||
window->res_class = g_strdup (wm_class);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_WM_CLASS]);
|
||||
+
|
||||
+ if (window->cgroup)
|
||||
+ meta_cgroup_update_app_info (window->cgroup, window);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -8169,6 +8172,9 @@ meta_window_set_gtk_dbus_properties (MetaWindow *window,
|
||||
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_GTK_WINDOW_OBJECT_PATH]);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (window));
|
||||
+
|
||||
+ if (window->cgroup)
|
||||
+ meta_cgroup_update_app_info (window->cgroup, window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
--
|
||||
2.44.0.501.g19981daefd.dirty
|
||||
|
15
mutter.spec
15
mutter.spec
@ -10,7 +10,7 @@
|
||||
|
||||
Name: mutter
|
||||
Version: 40.9
|
||||
Release: 21%{?dist}
|
||||
Release: 22%{?dist}
|
||||
Summary: Window and compositing manager based on Clutter
|
||||
|
||||
License: GPLv2+
|
||||
@ -139,6 +139,13 @@ Patch58: sticky-or-on-top-dialog-fixes.patch
|
||||
Patch59: 0001-wayland-wl-shell-Make-sure-created-window-has-a-prop.patch
|
||||
Patch60: 0002-window-Avoid-SIGFPE-on-bogus-window-size.patch
|
||||
|
||||
# RHEL-62997, RHEL-63000
|
||||
Patch61: 0001-display-Make-cgroup-constructor-local.patch
|
||||
Patch62: 0002-display-Also-set-window-cgroup-on-cgroup-creation.patch
|
||||
Patch63: 0003-window-Unregister-cgroup-on-unmanage.patch
|
||||
Patch64: 0004-window-Don-t-use-cgroup-workspace-if-there-already-i.patch
|
||||
Patch65: 0005-cgroup-Get-app-info-from-gnome-shell-when-possible.patch
|
||||
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: pango-devel
|
||||
BuildRequires: startup-notification-devel
|
||||
@ -286,6 +293,12 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
|
||||
%{_datadir}/mutter-%{mutter_api_version}/tests
|
||||
|
||||
%changelog
|
||||
* Fri Oct 18 2024 Jonas Ådahl <jadahl@redhat.com> - 40.9-22
|
||||
- Fix crash when moving window while switching workspace
|
||||
Resolves: RHEL-62997
|
||||
- Improve app discovery for workspace logic
|
||||
Resolves: RHEL-63000
|
||||
|
||||
* Fri Oct 18 2024 Jonas Ådahl <jadahl@redhat.com> - 40.9-21
|
||||
- Fix regression causing wl-copy to trigger a crash
|
||||
Resolves: RHEL-62993
|
||||
|
Loading…
Reference in New Issue
Block a user