monitor-config-store: Don't crash when cleaning up after failing to load

The logical monitor config array ownership was transferred to the
config object when it was created, but was not unset when the config
verification failed, causing the clean up path for invalid configs to
try to clean up the same list again.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-03-04 15:09:45 +08:00
parent 8163ca6821
commit ac68631f4c

View File

@ -546,6 +546,8 @@ handle_end_element (GMarkupParseContext *context,
meta_monitors_config_new (parser->current_logical_monitor_configs, meta_monitors_config_new (parser->current_logical_monitor_configs,
layout_mode); layout_mode);
parser->current_logical_monitor_configs = NULL;
if (!meta_verify_monitors_config (config, error)) if (!meta_verify_monitors_config (config, error))
{ {
g_object_unref (config); g_object_unref (config);
@ -555,8 +557,6 @@ handle_end_element (GMarkupParseContext *context,
g_hash_table_replace (parser->config_store->configs, g_hash_table_replace (parser->config_store->configs,
config->key, config); config->key, config);
parser->current_logical_monitor_configs = NULL;
parser->state = STATE_MONITORS; parser->state = STATE_MONITORS;
return; return;
} }