From af1a27928318cc377562ec4026a2cbbfad83cbca Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Mon, 21 Mar 2016 10:40:03 -0600 Subject: presets: fix import of old version-less preset files The version number was not added after import causing an attempt to do import conversions twice. The second conversion breaks values. --- gtk/src/presets.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gtk/src') diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 00454d865..167356690 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -685,8 +685,8 @@ presets_add_config_file(const gchar *name) return -2; } - hb_value_t *backup = hb_value_dup(preset); - int result = hb_presets_import(preset); + hb_value_t *imported; + int result = hb_presets_import(preset, &imported); if (result) { // hb_presets_import modified the preset. So make a backup @@ -694,19 +694,19 @@ presets_add_config_file(const gchar *name) config = ghb_get_user_config_dir(NULL); path = g_strdup_printf ("%s/presets.%d.%d.%d.json", config, major, minor, micro); - hb_value_write_json(backup, path); + hb_value_write_json(preset, path); g_free(config); g_free(path); } - hb_value_free(&backup); - hb_presets_add(preset); + hb_presets_add(imported); if (major != hb_major || minor != hb_minor || micro != hb_micro) { // Reload hb builtin presets hb_presets_builtin_update(); store_presets(); } + hb_value_free(&imported); hb_value_free(&preset); return 0; } -- cgit v1.2.3