monitor-manager-xrandr: Skip outputs with no modes

If we can't find any valid modes for an output we need to unwind and
skip the output because trying to use a modeless output later will
crash us.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
This commit is contained in:
Rui Matos 2015-10-27 15:24:58 +01:00
parent 57ae203aab
commit 8b200de35a

View File

@ -661,6 +661,8 @@ output_get_modes (MetaMonitorManager *manager,
} }
} }
meta_output->n_modes = n_actual_modes; meta_output->n_modes = n_actual_modes;
if (n_actual_modes > 0)
meta_output->preferred_mode = meta_output->modes[0];
} }
static char * static char *
@ -825,7 +827,6 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
output_get_tile_info (manager_xrandr, meta_output); output_get_tile_info (manager_xrandr, meta_output);
output_get_modes (manager, meta_output, output); output_get_modes (manager, meta_output, output);
meta_output->preferred_mode = meta_output->modes[0];
meta_output->n_possible_crtcs = output->ncrtc; meta_output->n_possible_crtcs = output->ncrtc;
meta_output->possible_crtcs = g_new0 (MetaCRTC *, meta_output->n_possible_crtcs); meta_output->possible_crtcs = g_new0 (MetaCRTC *, meta_output->n_possible_crtcs);
@ -873,7 +874,10 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
else else
meta_output->backlight = -1; meta_output->backlight = -1;
n_actual_outputs++; if (meta_output->n_modes == 0)
meta_monitor_manager_clear_output (meta_output);
else
n_actual_outputs++;
} }
XRRFreeOutputInfo (output); XRRFreeOutputInfo (output);