Wed Nov 15 02:05:27 2006 John Ellis <johne@verizon.net>
authorJohn Ellis <johne@verizon.net>
Wed, 15 Nov 2006 07:19:16 +0000 (07:19 +0000)
committerJohn Ellis <johne@verizon.net>
Wed, 15 Nov 2006 07:19:16 +0000 (07:19 +0000)
        * 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
src/view_file_icon.c
src/view_file_list.c

index 5bb5713..441787b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed Nov 15 02:05:27 2006  John Ellis  <johne@verizon.net>
+
+       * 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  <johne@verizon.net>
 
        * exif.[ch]: Fix memory alignment issues, bug #1593252.
index c230050..a1d02f2 100644 (file)
@@ -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;
 
index 0995fe7..4169171 100644 (file)
@@ -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);