changeset 965:cbdabb499684

keep files with non-zero marks in memory
author nadvornik
date Sat, 16 Aug 2008 20:57:40 +0000
parents ba1d3c4bc0cd
children c24a297efbef
files src/filedata.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Sat Aug 16 20:34:14 2008 +0000
+++ b/src/filedata.c	Sat Aug 16 20:57:40 2008 +0000
@@ -1061,9 +1061,20 @@
 
 void file_data_set_mark(FileData *fd, gint n, gboolean value)
 {
+	guint old = fd->marks;
 	if (!value == !(fd->marks & (1 << n))) return;
 
 	fd->marks = fd->marks ^ (1 << n);
+	
+	if (old && !fd->marks) /* keep files with non-zero marks in memory */
+		{
+		file_data_unref(fd);
+		}
+	else if (!old && fd->marks)
+		{
+		file_data_ref(fd);
+		}
+	
 	file_data_increment_version(fd);
 	file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL);
 }