mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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
This commit is contained in:
parent
150732a894
commit
8587f0e80d
@ -1554,18 +1554,19 @@ meta_monitor_config_restore_previous (MetaMonitorConfig *self,
|
|||||||
/* The user chose to restore the previous configuration. In this
|
/* The user chose to restore the previous configuration. In this
|
||||||
* case, restore the previous configuration. */
|
* case, restore the previous configuration. */
|
||||||
MetaConfiguration *prev_config = config_ref (self->previous);
|
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);
|
config_unref (prev_config);
|
||||||
|
|
||||||
/* After this, self->previous contains the rejected configuration.
|
/* After this, self->previous contains the rejected configuration.
|
||||||
* Since it was rejected, nuke it. */
|
* Since it was rejected, nuke it. */
|
||||||
g_clear_pointer (&self->previous, (GDestroyNotify) config_unref);
|
g_clear_pointer (&self->previous, (GDestroyNotify) config_unref);
|
||||||
|
|
||||||
|
if (ok)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (!meta_monitor_config_apply_stored (self, manager))
|
||||||
if (!meta_monitor_config_apply_stored (self, manager))
|
meta_monitor_config_make_default (self, manager);
|
||||||
meta_monitor_config_make_default (self, manager);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2029,7 +2030,11 @@ meta_monitor_config_assign_crtcs (MetaConfiguration *config,
|
|||||||
|
|
||||||
all_outputs = meta_monitor_manager_get_outputs (manager,
|
all_outputs = meta_monitor_manager_get_outputs (manager,
|
||||||
&n_outputs);
|
&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++)
|
for (i = 0; i < n_outputs; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user