From f39deaa95fa138798364b22f971251a790028772 Mon Sep 17 00:00:00 2001 From: John Ellis Date: Wed, 15 Nov 2006 07:19:16 +0000 Subject: [PATCH] Wed Nov 15 02:05:27 2006 John Ellis * view_file_icon.c: Fix odd crash when removing files, it seems the high priority idle sync is no longer called before the treeview tries to redraw itself, so fix the cleanup of removed pointers so that they are always valid or NULL (I wonder if the priorities used by GtkTreeView have changed in newer versions of GTK?). * view_file_list.c: Fix progress bar warning when files are removed before thumbnail generation is finished. --- ChangeLog | 10 ++++++++++ src/view_file_icon.c | 26 ++++++++++++++++++-------- src/view_file_list.c | 1 + 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5bb57136..441787bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Wed Nov 15 02:05:27 2006 John Ellis + + * view_file_icon.c: Fix odd crash when removing files, it seems the + high priority idle sync is no longer called before the treeview tries + to redraw itself, so fix the cleanup of removed pointers so that they + are always valid or NULL (I wonder if the priorities used by + GtkTreeView have changed in newer versions of GTK?). + * view_file_list.c: Fix progress bar warning when files are removed + before thumbnail generation is finished. + Tue Nov 14 15:36:14 2006 John Ellis * exif.[ch]: Fix memory alignment issues, bug #1593252. diff --git a/src/view_file_icon.c b/src/view_file_icon.c index c230050d..a1d02f2e 100644 --- a/src/view_file_icon.c +++ b/src/view_file_icon.c @@ -1,6 +1,6 @@ /* * GQview - * (C) 2004 John Ellis + * (C) 2006 John Ellis * * Author: John Ellis * @@ -64,6 +64,7 @@ struct _IconData { FileData fd; SelectionType selected; + gint row; }; @@ -85,6 +86,7 @@ static gint iconlist_read(const gchar *path, GList **list) memcpy(id, fd, sizeof(FileData)); id->selected = SELECTION_NONE; + id->row = -1; work->data = id; g_free(fd); @@ -1555,6 +1557,11 @@ static void vficon_populate(ViewFileIcon *vfi, gint resize, gint keep_position) list = vficon_add_row(vfi, &iter); while (work && list) { + FileData *fd; + + fd = work->data; + ICON_DATA(fd)->row = row; + list->data = work->data; list = list->next; work = work->next; @@ -1636,21 +1643,22 @@ static void vficon_sync(ViewFileIcon *vfi) while (list) { FileData *fd; + if (work) { fd = work->data; work = work->next; c++; + + ICON_DATA(fd)->row = r; } else { fd = NULL; } - if (list) - { - list->data = fd; - list = list->next; - } + + list->data = fd; + list = list->next; } } @@ -2398,7 +2406,7 @@ gint vficon_maint_renamed(ViewFileIcon *vfi, const gchar *source, const gchar *d vfi->list = filelist_insert_sort(vfi->list, fd, vfi->sort_method, vfi->sort_ascend); - vficon_sync(vfi); + vficon_sync_idle(vfi); ret = TRUE; } else @@ -2508,13 +2516,15 @@ gint vficon_maint_removed(ViewFileIcon *vfi, const gchar *path, GList *ignore_li /* Thumb loader check */ if (fd == vfi->thumbs_fd) vfi->thumbs_fd = NULL; + if (vfi->thumbs_count > 0) vfi->thumbs_count--; if (vfi->prev_selection == fd) vfi->prev_selection = NULL; if (vfi->click_fd == fd) vfi->click_fd = NULL; /* remove pointer to this fd from grid */ store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfi->listview)); - if (gtk_tree_model_iter_nth_child(store, &iter, NULL, row / vfi->columns)) + if (ICON_DATA(fd)->row >= 0 && + gtk_tree_model_iter_nth_child(store, &iter, NULL, ICON_DATA(fd)->row)) { GList *list; diff --git a/src/view_file_list.c b/src/view_file_list.c index 0995fe71..41691717 100644 --- a/src/view_file_list.c +++ b/src/view_file_list.c @@ -1886,6 +1886,7 @@ gint vflist_maint_removed(ViewFileList *vfl, const gchar *path, GList *ignore_li /* thumbnail loader check */ if (fd == vfl->thumbs_filedata) vfl->thumbs_filedata = NULL; + if (vfl->thumbs_count > 0) vfl->thumbs_count--; vfl->list = g_list_remove(vfl->list, fd); file_data_free(fd); -- 2.20.1