changeset 111:3a69a7a3f461

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.
author gqview
date Wed, 15 Nov 2006 07:19:16 +0000
parents 9fbf210edc6f
children b15d4c18168f
files ChangeLog src/view_file_icon.c src/view_file_list.c
diffstat 3 files changed, 29 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 14 20:39:14 2006 +0000
+++ b/ChangeLog	Wed Nov 15 07:19:16 2006 +0000
@@ -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.
--- a/src/view_file_icon.c	Tue Nov 14 20:39:14 2006 +0000
+++ b/src/view_file_icon.c	Wed Nov 15 07:19:16 2006 +0000
@@ -1,6 +1,6 @@
 /*
  * GQview
- * (C) 2004 John Ellis
+ * (C) 2006 John Ellis
  *
  * Author: John Ellis
  *
@@ -64,6 +64,7 @@
 {
 	FileData fd;
 	SelectionType selected;
+	gint row;
 };
 
 
@@ -85,6 +86,7 @@
 
 		memcpy(id, fd, sizeof(FileData));
 		id->selected = SELECTION_NONE;
+		id->row = -1;
 
 		work->data = id;
 		g_free(fd);
@@ -1555,6 +1557,11 @@
 		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 @@
 		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 @@
 
 		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 @@
 
 	/* 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;
 
--- a/src/view_file_list.c	Tue Nov 14 20:39:14 2006 +0000
+++ b/src/view_file_list.c	Wed Nov 15 07:19:16 2006 +0000
@@ -1886,6 +1886,7 @@
 
 	/* 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);