Fix a bug occuring when using certain actions on a collection
authorLaurent Monin <geeqie@norz.org>
Sat, 3 May 2008 16:58:17 +0000 (16:58 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 3 May 2008 16:58:17 +0000 (16:58 +0000)
item which is not in the selection.
Triggering it will either result in an assertion failure or a
segfault.

To reproduce:
- open a collection
- right-click on a non-selected image
- select Delete... menu entry (or Copy, Move, Rename, Properties...)

It results in the best case:
** ERROR **: file filelist.c: line 905 (file_data_ref): assertion failed: (fd->magick == 0x12345678)
or a pure segfault due to corrupted data.

collection_table_popup_file_list() has to return a list of filedata *
not a list of gchar *.

src/collect-table.c

index 4d9c036..643c08c 100644 (file)
@@ -569,7 +569,7 @@ static GList *collection_table_popup_file_list(CollectTable *ct)
                return collection_table_selection_get_list(ct);
                }
 
-       return g_list_append(NULL, g_strdup(ct->click_info->fd->path));
+       return g_list_append(NULL, file_data_ref(ct->click_info->fd));
 }
 
 static void collection_table_popup_edit_cb(GtkWidget *widget, gpointer data)