From 436785539e762a8dd9dec13e553670d38ca25b27 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Sat, 7 Nov 2020 10:18:17 +0000 Subject: [PATCH] Bug fix: --disable-clutter can cause crash If --disable-clutter has been issued, trying to load the map will cause a crash. --- src/rcfile.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/rcfile.c b/src/rcfile.c index 0d3a03c5..9fd5acaa 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1308,17 +1308,21 @@ static void options_parse_bar(GQParserData *parser_data, GMarkupParseContext *co #ifdef HAVE_LIBCHAMPLAIN_GTK else if (g_ascii_strcasecmp(element_name, "pane_gps") == 0) { - GtkWidget *pane = bar_find_pane_by_id(bar, PANE_GPS, options_get_id(attribute_names, attribute_values)); - if (pane) + /* Use this flag to determine if --disable-clutter has been issued */ + if (!options->disable_gpu) { - bar_pane_gps_update_from_config(pane, attribute_names, attribute_values); - } - else - { - pane = bar_pane_gps_new_from_config(attribute_names, attribute_values); - bar_add(bar, pane); + GtkWidget *pane = bar_find_pane_by_id(bar, PANE_GPS, options_get_id(attribute_names, attribute_values)); + if (pane) + { + bar_pane_gps_update_from_config(pane, attribute_names, attribute_values); + } + else + { + pane = bar_pane_gps_new_from_config(attribute_names, attribute_values); + bar_add(bar, pane); + } + options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); } - options_parse_func_push(parser_data, options_parse_leaf, NULL, NULL); } #endif #endif -- 2.20.1