Updating branch refs/heads/master
         to d168f769641c3d1939a0dadf5644d5da7202385d (commit)
       from 7871f2e665d7e1400d973750e0107d3e52447001 (commit)

commit d168f769641c3d1939a0dadf5644d5da7202385d
Author: Nick Schermer <n...@xfce.org>
Date:   Sat Oct 29 00:14:44 2011 +0200

    Some fixes for previous commit.

 plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c 
b/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c
index 13554ec..a1f81cc 100644
--- a/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c
+++ b/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c
@@ -143,7 +143,7 @@ pixbuf_thumbnailer_new_from_stream (GInputStream      
*stream,
 {
   GdkPixbufLoader *loader;
   gssize           n_read;
-  gboolean         result = TRUE;
+  gboolean         result;
   GdkPixbuf       *pixbuf = NULL;
   guchar           buffer[65536];
 
@@ -160,13 +160,16 @@ pixbuf_thumbnailer_new_from_stream (GInputStream      
*stream,
       n_read = g_input_stream_read (stream, buffer, sizeof (buffer),
                                     cancellable, error);
 
-      if (n_read <= 0)
+      if (n_read < 0)
         {
-          result = (n_read == 0);
+          result = FALSE;
           error = NULL;
           break;
         }
 
+      if (n_read == 0)
+        break;
+
       if (!gdk_pixbuf_loader_write (loader, buffer, n_read, error))
         {
           result = FALSE;
@@ -234,17 +237,19 @@ pixbuf_thumbnailer_create (TumblerAbstractThumbnailer 
*thumbnailer,
   thumbnail = tumbler_file_info_get_thumbnail (info);
   g_assert (thumbnail != NULL);
 
-  /* load the scaled pixbuf from the stream */
+  /* load the scaled pixbuf from the stream. this works like
+   * gdk_pixbuf_new_from_file_at_scale(), but without increasing the
+   * pixbuf size. */
   pixbuf = pixbuf_thumbnailer_new_from_stream (G_INPUT_STREAM (stream), 
thumbnail,
                                                cancellable, &error);
 
   g_object_unref (stream);
-  g_object_unref (thumbnail);
 
   if (pixbuf == NULL)
     {
       g_signal_emit_by_name (thumbnailer, "error", uri, error->code, 
error->message);
       g_error_free (error);
+      g_object_unref (thumbnail);
       return;
     }
 
@@ -273,4 +278,5 @@ pixbuf_thumbnailer_create (TumblerAbstractThumbnailer 
*thumbnailer,
     }
 
   g_object_unref (pixbuf);
+  g_object_unref (thumbnail);
 }
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to