Fix #460: Multiple duplicates
authorColin Clark <cclark@mcb.net>
Fri, 6 Jan 2017 13:20:26 +0000 (13:20 +0000)
committerColin Clark <cclark@mcb.net>
Fri, 6 Jan 2017 13:20:26 +0000 (13:20 +0000)
https://github.com/BestImageViewer/geeqie/issues/460

Ensure the duplicates lists do not contain more than one entry for each
physical file

src/dupe.c

index 27eb501..63ee5fa 100644 (file)
@@ -1756,6 +1756,40 @@ static void dupe_files_add(DupeWindow *dw, CollectionData *collection, CollectIn
 
        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);