Bug fix: --disable-clutter can cause crash
authorColin Clark <colin.clark@cclark.uk>
Sat, 7 Nov 2020 10:18:17 +0000 (10:18 +0000)
committerColin Clark <colin.clark@cclark.uk>
Sat, 7 Nov 2020 10:18:17 +0000 (10:18 +0000)
If --disable-clutter has been issued, trying to load the map will cause
a crash.

src/rcfile.c

index 0d3a03c..9fd5aca 100644 (file)
@@ -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