From c3df8719133a4708cdd564abb82ed0d6885f1eef Mon Sep 17 00:00:00 2001
From: Benedikt Meurer <benny@xfce.org>
Date: Tue, 29 Nov 2005 18:54:30 +0000
Subject: [PATCH] 2005-11-29	Benedikt Meurer <benny@xfce.org>

	* thunar/thunar-thumbnail-generator.c
	  (thunar_thumbnail_generator_thread): Don't generate thumbnails for
	  files for which only the generator owns a reference.




(Old svn revision: 18964)
---
 ChangeLog                           |  6 ++++++
 thunar/thunar-thumbnail-generator.c | 16 ++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7970f4ef3..b52b0489a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-29	Benedikt Meurer <benny@xfce.org>
+
+	* thunar/thunar-thumbnail-generator.c
+	  (thunar_thumbnail_generator_thread): Don't generate thumbnails for
+	  files for which only the generator owns a reference.
+
 2005-11-29	Benedikt Meurer <benny@xfce.org>
 
 	* thunar/thunar-standard-view.c
diff --git a/thunar/thunar-thumbnail-generator.c b/thunar/thunar-thumbnail-generator.c
index a2b59e09e..2ee8695f1 100644
--- a/thunar/thunar-thumbnail-generator.c
+++ b/thunar/thunar-thumbnail-generator.c
@@ -241,11 +241,19 @@ thunar_thumbnail_generator_thread (gpointer user_data)
       /* release the lock */
       g_mutex_unlock (generator->lock);
 
-      /* try to generate the thumbnail */
-      icon = thunar_vfs_thumb_factory_generate_thumbnail (generator->factory, info->info);
+      /* don't generate thumbnails for files for which only we own a reference */
+      if (G_LIKELY (G_OBJECT (info->file)->ref_count > 1))
+        {
+          /* try to generate the thumbnail */
+          icon = thunar_vfs_thumb_factory_generate_thumbnail (generator->factory, info->info);
 
-      /* store the thumbnail (or the failed notice) */
-      thunar_vfs_thumb_factory_store_thumbnail (generator->factory, icon, info->info, NULL);
+          /* store the thumbnail (or the failed notice) */
+          thunar_vfs_thumb_factory_store_thumbnail (generator->factory, icon, info->info, NULL);
+        }
+      else
+        {
+          icon = NULL;
+        }
 
       /* place the thumbnail on the reply list and schedule the idle source */
       g_mutex_lock (generator->lock);
-- 
GitLab