summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--divelist.c3
-rw-r--r--gtk-gui.c1
-rw-r--r--main.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/divelist.c b/divelist.c
index 8aa957d1e..f9ca3ef41 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1457,6 +1457,7 @@ static void fill_dive_list(void)
void dive_list_update_dives(void)
{
+ dive_table.preexisting = dive_table.nr;
gtk_tree_store_clear(TREESTORE(dive_list));
gtk_tree_store_clear(LISTSTORE(dive_list));
fill_dive_list();
@@ -2207,7 +2208,7 @@ void delete_single_dive(int idx)
remove_dive_from_trip(dive);
for (i = idx; i < dive_table.nr - 1; i++)
dive_table.dives[i] = dive_table.dives[i+1];
- dive_table.nr--;
+ dive_table.dives[--dive_table.nr] = NULL;
if (dive->selected)
amount_selected--;
/* free all allocations */
diff --git a/gtk-gui.c b/gtk-gui.c
index e165012d5..3df6fbf70 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -242,7 +242,6 @@ static void file_close(GtkWidget *w, gpointer data)
/* free the dives and trips */
while (dive_table.nr)
delete_single_dive(0);
- dive_table.preexisting = 0;
mark_divelist_changed(FALSE);
/* clear the selection and the statistics */
diff --git a/main.c b/main.c
index 307dd13c1..0e98d9059 100644
--- a/main.c
+++ b/main.c
@@ -181,6 +181,7 @@ void report_dives(gboolean is_imported, gboolean prefer_imported)
add_single_dive(i, merged);
delete_single_dive(i+1);
delete_single_dive(i+1);
+ mark_divelist_changed(TRUE);
}
/* make sure no dives are still marked as downloaded */
for (i = 1; i < dive_table.nr; i++)
@@ -195,7 +196,6 @@ void report_dives(gboolean is_imported, gboolean prefer_imported)
if (preexisting != dive_table.nr)
mark_divelist_changed(TRUE);
}
- dive_table.preexisting = dive_table.nr;
dive_list_update_dives();
}