Add patch to fix crash when selecting display with no modes (rhbz#1756553)

This commit is contained in:
Adam Williamson 2019-10-10 11:14:27 -07:00
parent 5584ce83ef
commit adc4e69042
2 changed files with 71 additions and 1 deletions

63
588.patch Normal file
View File

@ -0,0 +1,63 @@
From 0d41cfd6b39935940aa573af3a2e0a1492e6aadc Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 10 Oct 2019 09:50:30 +0200
Subject: [PATCH 1/2] display: Add guard for NULL mode in supported scale check
This may prevent crashes in certain error situations.
---
panels/display/cc-display-config-dbus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 81b2c46f7..cdddbb695 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -107,8 +107,10 @@ cc_display_mode_dbus_is_supported_scale (CcDisplayMode *pself,
double scale)
{
CcDisplayModeDBus *self = CC_DISPLAY_MODE_DBUS (pself);
-
guint i;
+
+ g_return_val_if_fail (pself != NULL, FALSE);
+
for (i = 0; i < self->supported_scales->len; i++)
if (g_array_index (self->supported_scales, double, i) == scale)
return TRUE;
--
2.22.0
From 74687108af9241bd12d95a8391a54103ed2bcc78 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 10 Oct 2019 09:51:55 +0200
Subject: [PATCH 2/2] display: Use correct mode for supported scale checking
Monitors may not always have a mode. This means we cannot look up the
mode on the fly, but instead need to have a heuristic to select a mode
if there is none.
Everything was in place already for this, except that one location was
still doing a fresh lookup, possibly causing a crash.
Fixes: #675
---
panels/display/cc-display-settings.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/panels/display/cc-display-settings.c b/panels/display/cc-display-settings.c
index fe2643ede..d793fccaa 100644
--- a/panels/display/cc-display-settings.c
+++ b/panels/display/cc-display-settings.c
@@ -397,7 +397,7 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
GtkWidget *scale_btn;
if (!cc_display_config_is_scaled_mode_valid (self->config,
- cc_display_monitor_get_mode (self->selected_output),
+ current_mode,
*scale) &&
cc_display_monitor_get_scale (self->selected_output) != *scale)
continue;
--
2.22.0

View File

@ -10,7 +10,7 @@
Name: gnome-control-center
Version: 3.34.1
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Utilities to configure the GNOME desktop
License: GPLv2+ and CC-BY-SA
@ -26,6 +26,10 @@ Patch1: 0001-region-Explicitly-update-LC_-even-when-matching-LANG.patch
# https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/587
Patch2: printers-provide-scheme-to-address-parser.patch
# https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/588
# https://bugzilla.redhat.com/show_bug.cgi?id=1756553
Patch3: 588.patch
BuildRequires: chrpath
BuildRequires: cups-devel
BuildRequires: desktop-file-utils
@ -195,6 +199,9 @@ chrpath --delete $RPM_BUILD_ROOT%{_bindir}/gnome-control-center
%dir %{_datadir}/gnome/wm-properties
%changelog
* Thu Oct 10 2019 Adam Williamson <awilliam@redhat.com> - 3.34.1-4
- Add patch to fix crash when selecting display with no modes (rhbz#1756553)
* Wed Oct 09 2019 Felipe Borges <feborges@redhat.com> - 3.34.1-3
- Add patch to fix parsing of addresses while adding printers (rhbz#1750394)