[mutter] monitor-config: Handle invalid previous configurations
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-config: Handle invalid previous configurations
- Date: Wed, 13 Apr 2016 16:17:21 +0000 (UTC)
commit 8587f0e80d7da4e8133466571fe4c884293eb700
Author: Rui Matos <tiagomatos gmail com>
Date: Tue Mar 29 21:56:28 2016 +0200
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
src/backends/meta-monitor-config.c | 19 ++++++++++++-------
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++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]