diff --git a/SOURCES/0001-monitor-Use-current-monitor-mode-to-check-whether-ac.patch b/SOURCES/0001-monitor-Use-current-monitor-mode-to-check-whether-ac.patch new file mode 100644 index 0000000..c5819df --- /dev/null +++ b/SOURCES/0001-monitor-Use-current-monitor-mode-to-check-whether-ac.patch @@ -0,0 +1,85 @@ +From 22d626580cd84136b54ca1154852da6f990c00a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Tue, 31 Jul 2018 11:18:51 +0000 +Subject: [PATCH 1/2] monitor: Use current monitor mode to check whether active + +For historical reasons meta_monitor_is_active() checked whether it is +active by checking whether the main output have a CRTC assigned and +whether that CRTC has a current mode. At a later point, the MetaMonitor +got its own mode abstraction (MetaMonitorMode), but +meta_monitor_is_active() was never updated to use this. + +An issue with checking the main output's CRTC state is that, if there is +some CRTC mode combination that for some reason isn't properly detected +by the MetaMonitorMode abstraction (e.g. some tiling configuration not +yet handled), meta_monitor_is_active() would return TRUE, even though no +(abstracted) mode was set. This would cause confusion here and there, +leading to NULL pointer dereferences due to the assumption that if a +monitor is active, it has an active mode. + +Instead, change meta_monitor_is_active() to directly check the current +monitor mode, and log a warning if the main output still happen to have +a CRTC with a mode assigned to it. This way, when an not undrestood CRTC +mode combination is encountered, instead of dereferencing NULL pointers, +simply assume the monitor is not active, which means that it will not be +managed or rendered by mutter at all. + +https://gitlab.gnome.org/GNOME/mutter/issues/130 + + +(cherry picked from commit 4d465eac0806eb1ead375e2852d4a9d6bc24524f) +--- + src/backends/meta-monitor.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c +index 98330661e..9a412a612 100644 +--- a/src/backends/meta-monitor.c ++++ b/src/backends/meta-monitor.c +@@ -203,13 +203,9 @@ meta_monitor_get_main_output (MetaMonitor *monitor) + gboolean + meta_monitor_is_active (MetaMonitor *monitor) + { +- MetaOutput *output; +- MetaCrtc *crtc; +- +- output = meta_monitor_get_main_output (monitor); +- crtc = meta_output_get_assigned_crtc (output); ++ MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor); + +- return crtc && crtc->current_mode; ++ return !!priv->current_mode; + } + + gboolean +@@ -1411,6 +1407,18 @@ meta_monitor_get_current_mode (MetaMonitor *monitor) + return priv->current_mode; + } + ++static gboolean ++is_current_mode_known (MetaMonitor *monitor) ++{ ++ MetaOutput *output; ++ MetaCrtc *crtc; ++ ++ output = meta_monitor_get_main_output (monitor); ++ crtc = meta_output_get_assigned_crtc (output); ++ ++ return meta_monitor_is_active (monitor) == (crtc && crtc->current_mode); ++} ++ + void + meta_monitor_derive_current_mode (MetaMonitor *monitor) + { +@@ -1430,6 +1438,8 @@ meta_monitor_derive_current_mode (MetaMonitor *monitor) + } + + priv->current_mode = current_mode; ++ ++ g_warn_if_fail (is_current_mode_known (monitor)); + } + + void +-- +2.21.0 + diff --git a/SOURCES/0002-window-Return-1-if-meta_window_get_monitor-is-called.patch b/SOURCES/0002-window-Return-1-if-meta_window_get_monitor-is-called.patch new file mode 100644 index 0000000..76191d9 --- /dev/null +++ b/SOURCES/0002-window-Return-1-if-meta_window_get_monitor-is-called.patch @@ -0,0 +1,38 @@ +From 760e22fd301df35a4bca9e0453a3877f1840a819 Mon Sep 17 00:00:00 2001 +From: Sam Spilsbury +Date: Wed, 11 Oct 2017 00:39:40 +0800 +Subject: [PATCH 2/2] window: Return -1 if meta_window_get_monitor is called on + an unmanaged window + +As opposed to crashing. In this case, letting the caller deal with +it is the best policy, since this is public API. + +https://bugzilla.gnome.org/show_bug.cgi?id=788834 +--- + src/core/window.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/core/window.c b/src/core/window.c +index cc0813ac4..79f0d6bc0 100644 +--- a/src/core/window.c ++++ b/src/core/window.c +@@ -3752,11 +3752,15 @@ maybe_move_attached_dialog (MetaWindow *window, + * + * Gets index of the monitor that this window is on. + * +- * Return Value: The index of the monitor in the screens monitor list ++ * Return Value: The index of the monitor in the screens monitor list, or -1 ++ * if the window has been recently unmanaged and does not have a monitor. + */ + int + meta_window_get_monitor (MetaWindow *window) + { ++ if (!window->monitor) ++ return -1; ++ + return window->monitor->number; + } + +-- +2.21.0 + diff --git a/SPECS/mutter.spec b/SPECS/mutter.spec index 7149b2e..074e383 100644 --- a/SPECS/mutter.spec +++ b/SPECS/mutter.spec @@ -10,7 +10,7 @@ Name: mutter Version: 3.28.3 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -81,6 +81,10 @@ Patch271: 0002-idle-monitor-Postpone-dispatching-of-idle-timeout-if.patch # Don't loose pointer button grabs (#1756263) Patch272: 0001-events-Sync-pending-pointer-events-without-a-window.patch +# Fix crash in meta_monitor_mode_get_resolution() (#1760738) +Patch273: 0001-monitor-Use-current-monitor-mode-to-check-whether-ac.patch +Patch274: 0002-window-Return-1-if-meta_window_get_monitor-is-called.patch + BuildRequires: chrpath BuildRequires: pango-devel BuildRequires: startup-notification-devel @@ -236,6 +240,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %{_libdir}/pkgconfig/* %changelog +* Fri Oct 11 2019 Jonas Ådahl - 3.28.3-12 +- Fix crash in meta_monitor_mode_get_resolution() + Resolves #1760738 + * Wed Oct 02 2019 Jonas Ådahl ) - 3.28.3-11 - Don't loose pointer button grabs Resolves: #1756263