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