summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2016-03-29 19:56:28 (GMT)
committerRui Matos <tiagomatos@gmail.com>2016-04-13 16:16:36 (GMT)
commit8587f0e80d7da4e8133466571fe4c884293eb700 (patch)
tree7509d654ffb3622bee726664edf2afb2ff813ab5
parent150732a8947c02e83f4c869c460cb91bfd3d7be5 (diff)
downloadmutter-8587f0e80d7da4e8133466571fe4c884293eb700.zip
mutter-8587f0e80d7da4e8133466571fe4c884293eb700.tar.xz
monitor-config: Handle invalid previous configurations
The previous configuration might not apply because the number of enabled outputs when trying to apply it might have changed. This isn't a bug so we shouldn't assert. Instead, we can handle it by falling back as we would if we didn't have a previous configuration to start with. https://bugzilla.gnome.org/show_bug.cgi?id=764286
-rw-r--r--src/backends/meta-monitor-config.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c
index e6e3791..a934613 100644
--- a/src/backends/meta-monitor-config.c
+++ b/src/backends/meta-monitor-config.c
@@ -1554,18 +1554,19 @@ meta_monitor_config_restore_previous (MetaMonitorConfig *self,
/* The user chose to restore the previous configuration. In this
* case, restore the previous configuration. */
MetaConfiguration *prev_config = config_ref (self->previous);
- apply_configuration (self, prev_config, manager);
+ gboolean ok = apply_configuration (self, prev_config, manager);
config_unref (prev_config);
/* After this, self->previous contains the rejected configuration.
* Since it was rejected, nuke it. */
g_clear_pointer (&self->previous, (GDestroyNotify) config_unref);
+
+ if (ok)
+ return;
}
- else
- {
- if (!meta_monitor_config_apply_stored (self, manager))
- meta_monitor_config_make_default (self, manager);
- }
+
+ if (!meta_monitor_config_apply_stored (self, manager))
+ meta_monitor_config_make_default (self, manager);
}
static void
@@ -2029,7 +2030,11 @@ meta_monitor_config_assign_crtcs (MetaConfiguration *config,
all_outputs = meta_monitor_manager_get_outputs (manager,
&n_outputs);
- g_assert (n_outputs == config->n_outputs);
+ if (n_outputs != config->n_outputs)
+ {
+ g_hash_table_destroy (assignment.info);
+ return FALSE;
+ }
for (i = 0; i < n_outputs; i++)
{