[Xfce4-commits] <thunar:master> Fix crash when trying to thumbnail a file with unknown content type.

Jannis Pohlmann noreply at xfce.org
Sat Feb 19 15:36:01 CET 2011


Updating branch refs/heads/master
         to b3f4ba8174af70d4aed5068333014ddd0d5e620d (commit)
       from 2ea05d8bff3773803517f7ab9cd415efcbfc9991 (commit)

commit b3f4ba8174af70d4aed5068333014ddd0d5e620d
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sat Feb 19 15:35:33 2011 +0100

    Fix crash when trying to thumbnail a file with unknown content type.

 NEWS                        |    4 ++++
 thunar/thunar-thumbnailer.c |   14 +++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 8bf5499..3129193 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+1.3.x
+=====
+- Fix crash when trying to thumbnail a file with unknown content type.
+
 1.3.0
 =====
 - Paste files in correct order (bug #6504).
diff --git a/thunar/thunar-thumbnailer.c b/thunar/thunar-thumbnailer.c
index 32d6218..b902d4e 100644
--- a/thunar/thunar-thumbnailer.c
+++ b/thunar/thunar-thumbnailer.c
@@ -396,6 +396,17 @@ thunar_thumbnailer_file_is_supported (ThunarThumbnailer *thumbnailer,
       return FALSE;
     }
 
+  /* determine the content type of the passed file */
+  content_type = thunar_file_get_content_type (file);
+
+  /* abort if the content type is unknown */
+  if (content_type == NULL)
+    {
+      /* release the thumbnailer lock */
+      g_mutex_unlock (thumbnailer->lock);
+      return FALSE;
+    }
+
   /* request the supported types on demand */
   if (thumbnailer->supported_schemes == NULL 
       || thumbnailer->supported_types == NULL)
@@ -412,9 +423,6 @@ thunar_thumbnailer_file_is_supported (ThunarThumbnailer *thumbnailer,
   if (thumbnailer->supported_schemes != NULL
       && thumbnailer->supported_types != NULL)
     {
-      /* determine the content type of the passed file */
-      content_type = thunar_file_get_content_type (file);
-
       /* go through all the URI schemes we support */
       for (n = 0; !supported && thumbnailer->supported_schemes[n] != NULL; ++n)
         {



More information about the Xfce4-commits mailing list