gnome-control-center/588.patch

64 lines
2.3 KiB
Diff

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