X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/a601900a8a3c66994e7878081b9dbb86451f8a03..3684f3627c0d8584f584249383422065ed442a98:/src/vikwaypoint.c?ds=inline diff --git a/src/vikwaypoint.c b/src/vikwaypoint.c index b9124359..2375c577 100644 --- a/src/vikwaypoint.c +++ b/src/vikwaypoint.c @@ -25,6 +25,7 @@ #include "vikcoord.h" #include "vikwaypoint.h" #include "globals.h" +#include "garminsymbols.h" #include VikWaypoint *vik_waypoint_new() @@ -41,10 +42,7 @@ void vik_waypoint_set_name(VikWaypoint *wp, const gchar *name) if ( wp->name ) g_free ( wp->name ); - if ( name && name[0] != '\0' ) - wp->name = g_strdup(name); - else - wp->name = NULL; + wp->name = g_strdup(name); } void vik_waypoint_set_comment_no_copy(VikWaypoint *wp, gchar *comment) @@ -93,10 +91,16 @@ void vik_waypoint_set_symbol(VikWaypoint *wp, const gchar *symname) if ( wp->symbol ) g_free ( wp->symbol ); - if ( symname && symname[0] != '\0' ) + // NB symbol_pixbuf is just a reference, so no need to free it + + if ( symname && symname[0] != '\0' ) { wp->symbol = g_strdup(symname); - else + wp->symbol_pixbuf = a_get_wp_sym ( wp->symbol ); + } + else { wp->symbol = NULL; + wp->symbol_pixbuf = NULL; + } } void vik_waypoint_free(VikWaypoint *wp)