diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-09-18 19:37:03 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-09-18 19:37:03 -0400 |
commit | f73e5b726808675ec3a02fe57f063b666e0706ac (patch) | |
tree | 5a5ffed01cbf32e5ab32f629dfdb19eb38c1c6ce | |
parent | f83625efa5d526a50c0ecbeed514360d7fb61e57 (diff) | |
download | subsurface-f73e5b726808675ec3a02fe57f063b666e0706ac.tar.gz |
When deleting dives make sure that amount_selected stays consistent
This could cause a crash if deleting the last dive and manually adding a
new one.
Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | divelist.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/divelist.c b/divelist.c index fb076a81b..514fdfed1 100644 --- a/divelist.c +++ b/divelist.c @@ -1754,13 +1754,16 @@ static void delete_dive_cb(GtkWidget *menuitem, GtkTreePath *path) dive_table.nr--; free(dive); dive_list_update_dives(); - /* now make sure the same dives stay selected and if necessary their trips are expanded */ + /* now make sure the same dives stay selected and if necessary their trips are expanded + * also make sure that amount_selected stays consistent */ + amount_selected = 0; for_each_dive(i, dive) { if (dive->selected) { GtkTreePath *path = get_path_from(dive); if (MODEL(dive_list) == TREEMODEL(dive_list)) gtk_tree_view_expand_to_path(tree_view, path); gtk_tree_selection_select_path(selection, path); + amount_selected++; } } mark_divelist_changed(TRUE); |