mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Don't duplicate gpsfixes if downloading them multiple times
Simply clear out the table (and free the "dives" that were created). Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0ddc77ed9d
commit
950436eba9
1 changed files with 9 additions and 0 deletions
|
@ -140,6 +140,14 @@ static void download_dialog_release_xml(struct download_dialog_state *state)
|
|||
free((void *)state->xmldata);
|
||||
}
|
||||
|
||||
static void clear_table(struct dive_table *table)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < table->nr; i++)
|
||||
free(table->dives[i]);
|
||||
table->nr = 0;
|
||||
}
|
||||
|
||||
static void download_dialog_response_cb(GtkDialog *d, gint response, gpointer data)
|
||||
{
|
||||
struct download_dialog_state *state = (struct download_dialog_state *)data;
|
||||
|
@ -150,6 +158,7 @@ static void download_dialog_response_cb(GtkDialog *d, gint response, gpointer da
|
|||
break;
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
/* apply download */
|
||||
clear_table(&gps_location_table);
|
||||
parse_xml_buffer(_("Webservice"), state->xmldata, state->xmldata_len, &gps_location_table, NULL);
|
||||
/* now merge the data in the gps_location table into the dive_table */
|
||||
if (merge_locations_into_dives()) {
|
||||
|
|
Loading…
Reference in a new issue