Blame SOURCES/0002-monitor-manager-xrandr-Ignore-outputs-without-modes.patch

2c033f
From f8c3fda5c7dbfff74a03713ae2a39dfbcd155693 Mon Sep 17 00:00:00 2001
2c033f
From: Rui Matos <tiagomatos@gmail.com>
2c033f
Date: Tue, 20 Oct 2015 16:01:30 +0200
2c033f
Subject: [PATCH 2/4] monitor-manager-xrandr: Ignore outputs without modes
2c033f
2c033f
In some cases we get outputs without any valid mode. We need to ignore
2c033f
them or we'll crash later.
2c033f
2c033f
https://bugzilla.gnome.org/show_bug.cgi?id=756796
2c033f
---
2c033f
 src/backends/x11/meta-monitor-manager-xrandr.c | 9 +++++++--
2c033f
 1 file changed, 7 insertions(+), 2 deletions(-)
2c033f
2c033f
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
2c033f
index 6653b33..9a64bb2 100644
2c033f
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
2c033f
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
2c033f
@@ -579,7 +579,13 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
2c033f
 
2c033f
       meta_output = &manager->outputs[n_actual_outputs];
2c033f
 
2c033f
-      if (output->connection != RR_Disconnected)
2c033f
+      /* Get this first so that if there are no valid modes we
2c033f
+         can immediately skip to the next output without having
2c033f
+         to unwind all the assignments below. */
2c033f
+      output_get_modes (manager, meta_output, output);
2c033f
+
2c033f
+      if (output->connection != RR_Disconnected &&
2c033f
+          meta_output->n_modes > 0)
2c033f
 	{
2c033f
           GBytes *edid;
2c033f
           MonitorInfo *parsed_edid;
2c033f
@@ -624,7 +630,6 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
2c033f
 	  meta_output->suggested_x = output_get_suggested_x (manager_xrandr, meta_output);
2c033f
 	  meta_output->suggested_y = output_get_suggested_y (manager_xrandr, meta_output);
2c033f
 
2c033f
-	  output_get_modes (manager, meta_output, output);
2c033f
 	  meta_output->preferred_mode = meta_output->modes[0];
2c033f
 
2c033f
 	  meta_output->n_possible_crtcs = output->ncrtc;
2c033f
-- 
2c033f
2.5.0
2c033f