[PATCH 2/4] Fix silly thinko in recent changes to "Delete dive" code

Linus Torvalds torvalds at linux-foundation.org
Sun Nov 18 10:16:07 PST 2012

From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sat, 17 Nov 2012 13:04:31 -0800
Subject: [PATCH 2/4] Fix silly thinko in recent changes to "Delete dive" code

Commit 38c79d149db0 ("Simplify and clean up dive trip management")
simplified the code a bit *too* much, and removed the check for

As a result, trying to delete a dive resulted in *all* dives being


Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

Ugh. This one was pretty bad. The commit that introduced this was correct 
in that everthing inside the if-statement was redundant with the 
cleaned-up dive trip management, but the "continue" at the end was very 
important. So removing the whole if-statement was wrong.

This just puts it back.

 divelist.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/divelist.c b/divelist.c
index 3e48d2fb9449..59db7c208609 100644
--- a/divelist.c
+++ b/divelist.c
@@ -2032,6 +2032,8 @@ static void delete_selected_dives_cb(GtkWidget *menuitem, GtkTreePath *path)
 		dive = get_dive(i);
 		if (!dive)
+		if (!dive->selected)
+			continue;
 		/* now remove the dive from the table and free it. also move the iterator back,
 		 * so that we don't skip a dive */

More information about the subsurface mailing list