changeset 2425:0af6b94854c2

Fix #460: Multiple duplicates https://github.com/BestImageViewer/geeqie/issues/460 Ensure the duplicates lists do not contain more than one entry for each physical file
author Colin Clark <cclark@mcb.net>
date Fri, 06 Jan 2017 13:20:26 +0000
parents 83d9886b9bcb
children 28546abc2b90
files src/dupe.c
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dupe.c	Thu Jan 05 13:53:31 2017 +0000
+++ b/src/dupe.c	Fri Jan 06 13:20:26 2017 +0000
@@ -1756,6 +1756,40 @@
 
 	if (!di) return;
 
+	/* Ensure images in the lists have unique FileDatas */
+	GList *work;
+	DupeItem *di_list;
+	work = g_list_first(dw->list);
+	while (work)
+		{
+		di_list = work->data;
+		if (di_list->fd == di->fd)
+			{
+			return;
+			}
+		else
+			{
+			work = work->next;
+			}
+		}
+
+	if (dw->second_list)
+		{
+		work = g_list_first(dw->second_list);
+		while (work)
+			{
+			di_list = work->data;
+			if (di_list->fd == di->fd)
+				{
+				return;
+				}
+			else
+				{
+				work = work->next;
+				}
+			}
+		}
+
 	if (dw->second_drop)
 		{
 		dupe_second_add(dw, di);