changeset 838:9bd49e725ad3

use FileData in thumb_loader
author nadvornik
date Sun, 15 Jun 2008 20:09:15 +0000
parents f8c22438376c
children 14520c3a91f8
files src/cache_maint.c src/collect-io.c src/dupe.c src/pan-view.c src/search.c src/thumb.c src/thumb.h src/thumb_standard.c src/thumb_standard.h src/typedefs.h src/view_file_icon.c src/view_file_list.c
diffstat 12 files changed, 93 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/src/cache_maint.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/cache_maint.c	Sun Jun 15 20:09:15 2008 +0000
@@ -788,7 +788,7 @@
 					   cache_manager_render_thumb_done_cb,
 					   NULL, cd);
 		thumb_loader_set_cache((ThumbLoader *)cd->tl, TRUE, cd->local, TRUE);
-		success = thumb_loader_start((ThumbLoader *)cd->tl, fd->path);
+		success = thumb_loader_start((ThumbLoader *)cd->tl, fd);
 		if (success)
 			{
 			gtk_entry_set_text(GTK_ENTRY(cd->progress), fd->path);
--- a/src/collect-io.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/collect-io.c	Sun Jun 15 20:09:15 2008 +0000
@@ -289,7 +289,7 @@
 				   cd);
 
 	/* start it */
-	if (!thumb_loader_start(cd->thumb_loader, ci->fd->path))
+	if (!thumb_loader_start(cd->thumb_loader, ci->fd))
 		{
 		/* error, handle it, do next */
 		DEBUG_1("error loading thumb for %s", ci->fd->path);
--- a/src/dupe.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/dupe.c	Sun Jun 15 20:09:15 2008 +0000
@@ -1340,7 +1340,7 @@
 				   dw);
 
 	/* start it */
-	if (!thumb_loader_start(dw->thumb_loader, di->fd->path))
+	if (!thumb_loader_start(dw->thumb_loader, di->fd))
 		{
 		/* error, handle it, do next */
 		DEBUG_1("error loading thumb for %s", di->fd->path);
--- a/src/pan-view.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/pan-view.c	Sun Jun 15 20:09:15 2008 +0000
@@ -233,7 +233,7 @@
 					   pan_queue_thumb_done_cb,
 					   NULL, pw);
 
-		if (thumb_loader_start(pw->tl, pi->fd->path)) return FALSE;
+		if (thumb_loader_start(pw->tl, pi->fd)) return FALSE;
 
 		thumb_loader_free(pw->tl);
 		pw->tl = NULL;
--- a/src/search.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/search.c	Sun Jun 15 20:09:15 2008 +0000
@@ -720,9 +720,6 @@
 	if (!sd->thumb_loader || !sd->thumb_fd) return;
 	fd = sd->thumb_fd;
 
-	if (fd->pixbuf) g_object_unref(fd->pixbuf);
-	fd->pixbuf = thumb_loader_get_pixbuf(sd->thumb_loader, TRUE);
-
 	search_result_thumb_set(sd, fd, NULL);
 }
 
@@ -795,7 +792,7 @@
 				   search_result_thumb_done_cb,
 				   NULL,
 				   sd);
-	if (!thumb_loader_start(sd->thumb_loader, mfd->fd->path))
+	if (!thumb_loader_start(sd->thumb_loader, mfd->fd))
 		{
 		search_result_thumb_do(sd);
 		search_result_thumb_step(sd);
--- a/src/thumb.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/thumb.c	Sun Jun 15 20:09:15 2008 +0000
@@ -25,7 +25,7 @@
 
 
 static void thumb_loader_error_cb(ImageLoader *il, gpointer data);
-static void thumb_loader_setup(ThumbLoader *tl, gchar *path);
+static void thumb_loader_setup(ThumbLoader *tl, const gchar *path);
 
 static gint normalize_thumb(gint *width, gint *height, gint max_w, gint max_h);
 static GdkPixbuf *get_xv_thumbnail(gchar *thumb_filename, gint max_w, gint max_h);
@@ -43,15 +43,15 @@
 	gint success = FALSE;
 	mode_t mode = 0755;
 
-	if (!tl || !tl->pixbuf) return FALSE;
+	if (!tl || !tl->fd || !tl->fd->pixbuf) return FALSE;
 
-	cache_dir = cache_get_location(CACHE_TYPE_THUMB, tl->path, FALSE, &mode);
+	cache_dir = cache_get_location(CACHE_TYPE_THUMB, tl->fd->path, FALSE, &mode);
 
 	if (cache_ensure_dir_exists(cache_dir, mode))
 		{
 		gchar *cache_path;
 		gchar *pathl;
-		gchar *name = g_strconcat(filename_from_path(tl->path), GQ_CACHE_EXT_THUMB, NULL);
+		gchar *name = g_strconcat(filename_from_path(tl->fd->path), GQ_CACHE_EXT_THUMB, NULL);
 
 		cache_path = g_build_filename(cache_dir, name, NULL);
 		g_free(name);
@@ -59,13 +59,13 @@
 		DEBUG_1("Saving thumb: %s", cache_path);
 
 		pathl = path_from_utf8(cache_path);
-		success = pixbuf_to_file_as_png(tl->pixbuf, pathl);
+		success = pixbuf_to_file_as_png(tl->fd->pixbuf, pathl);
 		if (success)
 			{
 			struct utimbuf ut;
 			/* set thumb time to that of source file */
 
-			ut.actime = ut.modtime = filetime(tl->path);
+			ut.actime = ut.modtime = filetime(tl->fd->path);
 			if (ut.modtime > 0)
 				{
 				utime(pathl, &ut);
@@ -93,14 +93,14 @@
 
 	if (!tl) return FALSE;
 
-	cache_dir = cache_get_location(CACHE_TYPE_THUMB, tl->path, FALSE, &mode);
+	cache_dir = cache_get_location(CACHE_TYPE_THUMB, tl->fd->path, FALSE, &mode);
 
 	if (cache_ensure_dir_exists(cache_dir, mode))
 		{
 		gchar *cache_path;
 		gchar *pathl;
 		FILE *f;
-		gchar *name = g_strconcat(filename_from_path(tl->path), GQ_CACHE_EXT_THUMB, NULL);
+		gchar *name = g_strconcat(filename_from_path(tl->fd->path), GQ_CACHE_EXT_THUMB, NULL);
 
 		cache_path = g_build_filename(cache_dir, name, NULL);
 		g_free(name);
@@ -115,7 +115,7 @@
 
 			fclose(f);
 
-			ut.actime = ut.modtime = filetime(tl->path);
+			ut.actime = ut.modtime = filetime(tl->fd->path);
 			if (ut.modtime > 0)
 				{
 				utime(pathl, &ut);
@@ -148,12 +148,12 @@
 	gint pw, ph;
 	gint save;
 
-	DEBUG_1("thumb done: %s", tl->path);
+	DEBUG_1("thumb done: %s", tl->fd->path);
 
 	pixbuf = image_loader_get_pixbuf(tl->il);
 	if (!pixbuf)
 		{
-		DEBUG_1("...but no pixbuf: %s", tl->path);
+		DEBUG_1("...but no pixbuf: %s", tl->fd->path);
 		thumb_loader_error_cb(tl->il, tl);
 		return;
 		}
@@ -164,17 +164,17 @@
 	if (tl->cache_hit && pw != tl->max_w && ph != tl->max_h)
 		{
 		/* requested thumbnail size may have changed, load original */
-		DEBUG_1("thumbnail size mismatch, regenerating: %s", tl->path);
+		DEBUG_1("thumbnail size mismatch, regenerating: %s", tl->fd->path);
 		tl->cache_hit = FALSE;
 
-		thumb_loader_setup(tl, tl->path);
+		thumb_loader_setup(tl, tl->fd->path);
 
 		if (!image_loader_start(tl->il, thumb_loader_done_cb, tl))
 			{
 			image_loader_free(tl->il);
 			tl->il = NULL;
 
-			DEBUG_1("regeneration failure: %s", tl->path);
+			DEBUG_1("regeneration failure: %s", tl->fd->path);
 			thumb_loader_error_cb(tl->il, tl);
 			}
 		return;
@@ -198,14 +198,22 @@
 			w = (double)h / ph * pw;
 			if (w < 1) w = 1;
 			}
-
-		tl->pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, (GdkInterpType)options->thumbnails.quality);
+		
+		if (tl->fd)
+			{
+			if (tl->fd->pixbuf) g_object_unref(tl->fd->pixbuf);
+			tl->fd->pixbuf = gdk_pixbuf_scale_simple(pixbuf, w, h, (GdkInterpType)options->thumbnails.quality);
+			}
 		save = TRUE;
 		}
 	else
 		{
-		tl->pixbuf = pixbuf;
-		gdk_pixbuf_ref(tl->pixbuf);
+		if (tl->fd)
+			{
+			if (tl->fd->pixbuf) g_object_unref(tl->fd->pixbuf);
+			tl->fd->pixbuf = pixbuf;
+			gdk_pixbuf_ref(tl->fd->pixbuf);
+			}
 		save = il->shrunk;
 		}
 
@@ -229,7 +237,7 @@
 		return;
 		}
 
-	DEBUG_1("thumb error: %s", tl->path);
+	DEBUG_1("thumb error: %s", tl->fd->path);
 
 	image_loader_free(tl->il);
 	tl->il = NULL;
@@ -253,10 +261,12 @@
 	if (tl->idle_done_id == -1) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
 }
 
-static void thumb_loader_setup(ThumbLoader *tl, gchar *path)
+static void thumb_loader_setup(ThumbLoader *tl, const gchar *path)
 {
+	FileData *fd = file_data_new_simple(path);
 	image_loader_free(tl->il);
-	tl->il = image_loader_new(file_data_new_simple(path));
+	tl->il = image_loader_new(fd);
+	file_data_unref(fd);
 
 	if (options->thumbnails.fast)
 		{
@@ -311,7 +321,7 @@
 }
 
 
-gint thumb_loader_start(ThumbLoader *tl, const gchar *path)
+gint thumb_loader_start(ThumbLoader *tl, FileData *fd)
 {
 	gchar *cache_path = NULL;
 
@@ -319,22 +329,22 @@
 
 	if (tl->standard_loader)
 		{
-		return thumb_loader_std_start((ThumbLoaderStd *)tl, path);
+		return thumb_loader_std_start((ThumbLoaderStd *)tl, fd);
 		}
 
-	if (!tl->path && !path) return FALSE;
+	if (!tl->fd && !fd) return FALSE;
 
-	if (!tl->path) tl->path = g_strdup(path);
+	if (!tl->fd) tl->fd = file_data_ref(fd);
 
 	if (tl->cache_enable)
 		{
-		cache_path = cache_find_location(CACHE_TYPE_THUMB, tl->path);
+		cache_path = cache_find_location(CACHE_TYPE_THUMB, tl->fd->path);
 
 		if (cache_path)
 			{
-			if (cache_time_valid(cache_path, tl->path))
+			if (cache_time_valid(cache_path, tl->fd->path))
 				{
-				DEBUG_1("Found in cache:%s", tl->path);
+				DEBUG_1("Found in cache:%s", tl->fd->path);
 
 				if (filesize(cache_path) == 0)
 					{
@@ -355,8 +365,9 @@
 
 	if (!cache_path && options->thumbnails.use_xvpics)
 		{
-		tl->pixbuf = get_xv_thumbnail(tl->path, tl->max_w, tl->max_h);
-		if (tl->pixbuf)
+		if (tl->fd->pixbuf) g_object_unref(tl->fd->pixbuf);
+		tl->fd->pixbuf = get_xv_thumbnail(tl->fd->path, tl->max_w, tl->max_h);
+		if (tl->fd->pixbuf)
 			{
 			thumb_loader_delay_done(tl);
 			return TRUE;
@@ -371,7 +382,7 @@
 		}
 	else
 		{
-		thumb_loader_setup(tl, tl->path);
+		thumb_loader_setup(tl, tl->fd->path);
 		}
 
 	if (!image_loader_start(tl->il, thumb_loader_done_cb, tl))
@@ -382,7 +393,7 @@
 			tl->cache_hit = FALSE;
 			log_printf("%s", _("Thumbnail image in cache failed to load, trying to recreate.\n"));
 
-			thumb_loader_setup(tl, tl->path);
+			thumb_loader_setup(tl, tl->fd->path);
 			if (image_loader_start(tl->il, thumb_loader_done_cb, tl)) return TRUE;
 			}
 		/* mark failed thumbnail in cache with 0 byte file */
@@ -419,9 +430,9 @@
 		return thumb_loader_std_get_pixbuf((ThumbLoaderStd *)tl, with_fallback);
 		}
 
-	if (tl && tl->pixbuf)
+	if (tl && tl->fd && tl->fd->pixbuf)
 		{
-		pixbuf = tl->pixbuf;
+		pixbuf = tl->fd->pixbuf;
 		g_object_ref(pixbuf);
 		}
 	else if (with_fallback)
@@ -471,7 +482,7 @@
 
 	tl = g_new0(ThumbLoader, 1);
 	tl->standard_loader = FALSE;
-	tl->path = NULL;
+	tl->fd = NULL;
 	tl->cache_enable = options->thumbnails.enable_caching;
 	tl->cache_hit = FALSE;
 	tl->percent_done = 0.0;
@@ -495,9 +506,8 @@
 		return;
 		}
 
-	if (tl->pixbuf) gdk_pixbuf_unref(tl->pixbuf);
 	image_loader_free(tl->il);
-	g_free(tl->path);
+	file_data_unref(tl->fd);
 
 	if (tl->idle_done_id != -1) g_source_remove(tl->idle_done_id);
 
--- a/src/thumb.h	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/thumb.h	Sun Jun 15 20:09:15 2008 +0000
@@ -23,7 +23,7 @@
 				gpointer data);
 void thumb_loader_set_cache(ThumbLoader *tl, gint enable_cache, gint local, gint retry_failed);
 
-gint thumb_loader_start(ThumbLoader *tl, const gchar *path);
+gint thumb_loader_start(ThumbLoader *tl, FileData *fd);
 void thumb_loader_free(ThumbLoader *tl);
 
 GdkPixbuf *thumb_loader_get_pixbuf(ThumbLoader *tl, gint with_fallback);
--- a/src/thumb_standard.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/thumb_standard.c	Sun Jun 15 20:09:15 2008 +0000
@@ -19,6 +19,7 @@
 #include "md5-util.h"
 #include "pixbuf_util.h"
 #include "ui_fileops.h"
+#include "filedata.h"
 
 
 /*
@@ -77,9 +78,8 @@
 	tl->requested_width = width;
 	tl->requested_height = height;
 
-	tl->pixbuf = NULL;
 	tl->il = NULL;
-	tl->source_path = NULL;
+	tl->fd = NULL;
 
 	tl->cache_enable = options->thumbnails.enable_caching;
 	tl->cache_local = FALSE;
@@ -104,14 +104,11 @@
 
 static void thumb_loader_std_reset(ThumbLoaderStd *tl)
 {
-	if (tl->pixbuf) g_object_unref(tl->pixbuf);
-	tl->pixbuf = NULL;
-
 	image_loader_free(tl->il);
 	tl->il = NULL;
 
-	g_free(tl->source_path);
-	tl->source_path = NULL;
+	file_data_unref(tl->fd);
+	tl->fd = NULL;
 
 	g_free(tl->thumb_path);
 	tl->thumb_path = NULL;
@@ -171,7 +168,7 @@
 	const gchar *folder;
 	gint w, h;
 
-	if (!tl->source_path || !tl->thumb_uri) return NULL;
+	if (!tl->fd || !tl->thumb_uri) return NULL;
 
 	if (pixbuf)
 		{
@@ -197,7 +194,7 @@
 		folder = THUMB_FOLDER_NORMAL;
 		}
 
-	return thumb_std_cache_path(tl->source_path,
+	return thumb_std_cache_path(tl->fd->path,
 				    (local) ?  tl->local_uri : tl->thumb_uri,
 				    local, folder);
 }
@@ -233,7 +230,7 @@
 			if (mtime_str && strtol(mtime_str, NULL, 10) == tl->source_mtime)
 				{
 				result = TRUE;
-				DEBUG_1("thumb fail valid: %s", tl->source_path);
+				DEBUG_1("thumb fail valid: %s", tl->fd->path);
 				DEBUG_1("           thumb: %s", fail_path);
 				}
 
@@ -317,7 +314,7 @@
 			struct stat st;
 			gchar *source_base;
 
-			source_base = remove_level_from_path(tl->source_path);
+			source_base = remove_level_from_path(tl->fd->path);
 			if (stat_utf8(source_base, &st))
 				{
 				cache_ensure_dir_exists(base_path, st.st_mode);
@@ -331,7 +328,7 @@
 		}
 	g_free(base_path);
 
-	DEBUG_1("thumb saving: %s", tl->source_path);
+	DEBUG_1("thumb saving: %s", tl->fd->path);
 	DEBUG_1("       saved: %s", tl->thumb_path);
 
 	/* save thumb, using a temp file then renaming into place */
@@ -369,7 +366,7 @@
 		g_free(tmp_path);
 		if (!success)
 			{
-			DEBUG_1("thumb save failed: %s", tl->source_path);
+			DEBUG_1("thumb save failed: %s", tl->fd->path);
 			DEBUG_1("            thumb: %s", tl->thumb_path);
 			}
 
@@ -451,7 +448,7 @@
 
 			tl->cache_hit = FALSE;
 
-			DEBUG_1("thumb copied: %s", tl->source_path);
+			DEBUG_1("thumb copied: %s", tl->fd->path);
 
 			thumb_loader_std_save(tl, pixbuf);
 			}
@@ -520,7 +517,7 @@
 			tl->thumb_path = NULL;
 			}
 
-		if (thumb_loader_std_setup(tl, tl->source_path)) return TRUE;
+		if (thumb_loader_std_setup(tl, tl->fd->path)) return TRUE;
 		}
 
 	thumb_loader_std_save(tl, NULL);
@@ -532,7 +529,7 @@
 	ThumbLoaderStd *tl = data;
 	GdkPixbuf *pixbuf;
 
-	DEBUG_1("thumb image done: %s", tl->source_path);
+	DEBUG_1("thumb image done: %s", tl->fd->path);
 	DEBUG_1("            from: %s", tl->il->path);
 
 	pixbuf = image_loader_get_pixbuf(tl->il);
@@ -553,7 +550,11 @@
 
 	tl->cache_hit = (tl->thumb_path != NULL);
 
-	tl->pixbuf = thumb_loader_std_finish(tl, pixbuf, il->shrunk);
+	if (tl->fd)
+		{
+		if (tl->fd->pixbuf) g_object_unref(tl->fd->pixbuf);
+		tl->fd->pixbuf = thumb_loader_std_finish(tl, pixbuf, il->shrunk);
+		}
 
 	if (tl->func_done) tl->func_done(tl, tl->data);
 }
@@ -569,7 +570,7 @@
 		return;
 		}
 	
-	DEBUG_1("thumb image error: %s", tl->source_path);
+	DEBUG_1("thumb image error: %s", tl->fd->path);
 	DEBUG_1("             from: %s", tl->il->fd->path);
 
 	if (thumb_loader_std_next_source(tl, TRUE)) return;
@@ -633,28 +634,28 @@
 	tl->cache_retry = retry_failed;
 }
 
-gint thumb_loader_std_start(ThumbLoaderStd *tl, const gchar *path)
+gint thumb_loader_std_start(ThumbLoaderStd *tl, FileData *fd)
 {
 	static gchar *thumb_cache = NULL;
 	struct stat st;
 
-	if (!tl || !path) return FALSE;
+	if (!tl || !fd) return FALSE;
 
 	thumb_loader_std_reset(tl);
 
-	if (!stat_utf8(path, &st)) return FALSE;
+	if (!stat_utf8(fd->path, &st)) return FALSE;
 
-	tl->source_path = g_strdup(path);
+	tl->fd = file_data_ref(fd);
 	tl->source_mtime = st.st_mtime;
 	tl->source_size = st.st_size;
 	tl->source_mode = st.st_mode;
 
 	if (!thumb_cache) thumb_cache = g_build_filename(homedir(), THUMB_FOLDER_GLOBAL, NULL);
-	if (strncmp(tl->source_path, thumb_cache, strlen(thumb_cache)) != 0)
+	if (strncmp(tl->fd->path, thumb_cache, strlen(thumb_cache)) != 0)
 		{
 		gchar *pathl;
 
-		pathl = path_from_utf8(path);
+		pathl = path_from_utf8(fd->path);
 		tl->thumb_uri = g_filename_to_uri(pathl, NULL, NULL);
 		tl->local_uri = filename_from_path(tl->thumb_uri);
 		g_free(pathl);
@@ -675,7 +676,7 @@
 		return thumb_loader_std_next_source(tl, found);
 		}
 
-	if (!thumb_loader_std_setup(tl, tl->source_path))
+	if (!thumb_loader_std_setup(tl, tl->fd->path))
 		{
 		thumb_loader_std_save(tl, NULL);
 		return FALSE;
@@ -696,9 +697,9 @@
 {
 	GdkPixbuf *pixbuf;
 
-	if (tl && tl->pixbuf)
+	if (tl && tl->fd && tl->fd->pixbuf)
 		{
-		pixbuf = tl->pixbuf;
+		pixbuf = tl->fd->pixbuf;
 		g_object_ref(pixbuf);
 		}
 	else if (with_fallback)
@@ -963,11 +964,11 @@
 			tm->tl->cache_hit = FALSE;
 			tm->tl->cache_local = FALSE;
 
-			g_free(tm->tl->source_path);
-			tm->tl->source_path = g_strdup(tm->dest);
+			file_data_unref(tm->tl->fd);
+			tm->tl->fd = file_data_new_simple(tm->dest);
 			tm->tl->source_mtime = strtol(mtime_str, NULL, 10);
 
-			pathl = path_from_utf8(tm->tl->source_path);
+			pathl = path_from_utf8(tm->tl->fd->path);
 			g_free(tm->tl->thumb_uri);
 			tm->tl->thumb_uri = g_filename_to_uri(pathl, NULL, NULL);
 			tm->tl->local_uri = filename_from_path(tm->tl->thumb_uri);
--- a/src/thumb_standard.h	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/thumb_standard.h	Sun Jun 15 20:09:15 2008 +0000
@@ -30,10 +30,8 @@
 {
 	gint standard_loader;
 
-	GdkPixbuf *pixbuf;
 	ImageLoader *il;
-
-	gchar *source_path;
+	FileData *fd;
 
 	time_t source_mtime;
 	off_t source_size;
@@ -70,7 +68,7 @@
 				    ThumbLoaderStdFunc func_progress,
 				    gpointer data);
 void thumb_loader_std_set_cache(ThumbLoaderStd *tl, gint enable_cache, gint local, gint retry_failed);
-gint thumb_loader_std_start(ThumbLoaderStd *tl, const gchar *path);
+gint thumb_loader_std_start(ThumbLoaderStd *tl, FileData *fd);
 void thumb_loader_std_free(ThumbLoaderStd *tl);
 
 GdkPixbuf *thumb_loader_std_get_pixbuf(ThumbLoaderStd *tl, gint with_fallback);
--- a/src/typedefs.h	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/typedefs.h	Sun Jun 15 20:09:15 2008 +0000
@@ -226,9 +226,8 @@
 {
 	gint standard_loader;
 
-	GdkPixbuf *pixbuf;	/* contains final (scaled) image when done */
 	ImageLoader *il;
-	gchar *path;
+	FileData *fd;           /* fd->pixbuf contains final (scaled) image when done */
 
 	gint cache_enable;
 	gint cache_hit;
--- a/src/view_file_icon.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/view_file_icon.c	Sun Jun 15 20:09:15 2008 +0000
@@ -1488,7 +1488,7 @@
 	gtk_list_store_clear(GTK_LIST_STORE(store));
 }
 
-static void vficon_set_thumb(ViewFile *vf, FileData *fd, GdkPixbuf *pb)
+static void vficon_set_thumb(ViewFile *vf, FileData *fd)
 {
 	GtkTreeModel *store;
 	GtkTreeIter iter;
@@ -1498,10 +1498,6 @@
 
 	store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview));
 
-	if (pb) g_object_ref(pb);
-	if (fd->pixbuf) g_object_unref(fd->pixbuf);
-	fd->pixbuf = pb;
-
 	gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &list, -1);
 	gtk_list_store_set(GTK_LIST_STORE(store), &iter, FILE_COLUMN_POINTER, list, -1);
 }
@@ -1826,13 +1822,9 @@
 
 static void vficon_thumb_do(ViewFile *vf, ThumbLoader *tl, FileData *fd)
 {
-	GdkPixbuf *pixbuf;
-
 	if (!fd) return;
 
-	pixbuf = thumb_loader_get_pixbuf(tl, TRUE);
-	vficon_set_thumb(vf, fd, pixbuf);
-	g_object_unref(pixbuf);
+	vficon_set_thumb(vf, fd);
 
 	vficon_thumb_status(vf, (gdouble)(vf->thumbs_count) / g_list_length(vf->list), _("Loading thumbs..."));
 }
@@ -1934,10 +1926,10 @@
 				   NULL,
 				   vf);
 
-	if (!thumb_loader_start(vf->thumbs_loader, fd->path))
+	if (!thumb_loader_start(vf->thumbs_loader, fd))
 		{
 		/* set icon to unknown, continue */
-		DEBUG_1("thumb loader start failed %s", vf->thumbs_loader->path);
+		DEBUG_1("thumb loader start failed %s", fd->path);
 		vficon_thumb_do(vf, vf->thumbs_loader, fd);
 
 		return TRUE;
--- a/src/view_file_list.c	Sat Jun 14 21:49:48 2008 +0000
+++ b/src/view_file_list.c	Sun Jun 15 20:09:15 2008 +0000
@@ -1008,9 +1008,6 @@
 
 	if (!fd || vflist_find_row(vf, fd, &iter) < 0) return;
 
-	if (fd->pixbuf) g_object_unref(fd->pixbuf);
-	fd->pixbuf = thumb_loader_get_pixbuf(tl, TRUE);
-
 	store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)));
 	gtk_tree_store_set(store, &iter, FILE_COLUMN_THUMB, fd->pixbuf, -1);
 
@@ -1113,10 +1110,10 @@
 				   NULL,
 				   vf);
 
-	if (!thumb_loader_start(vf->thumbs_loader, fd->path))
+	if (!thumb_loader_start(vf->thumbs_loader, fd))
 		{
 		/* set icon to unknown, continue */
-		DEBUG_1("thumb loader start failed %s", vf->thumbs_loader->path);
+		DEBUG_1("thumb loader start failed %s", fd->path);
 		vflist_thumb_do(vf, vf->thumbs_loader, fd);
 
 		return TRUE;