[Xfce4-commits] [xfce/tumbler] 01/06: According to the API doc of GdkPixbuf, gdk_pixbuf_loader_write will close the pixbuf loader on error.

noreply at xfce.org noreply at xfce.org
Wed Jun 7 12:03:29 CEST 2017


This is an automated email from the git hooks/post-receive script.

a   l   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   2   
   in repository xfce/tumbler.

commit 72bd7cba0920d239f2212194e42a2efd9dbbbf00
Author: Ali Abdallah <ali at xfce.org>
Date:   Wed Jun 7 09:51:34 2017 +0200

    According to the API doc of GdkPixbuf, gdk_pixbuf_loader_write will close the pixbuf loader on error.
    
    This commit adds a check for error so that we don't re-close the
    pixbuf loader (which causes sigabrt). Fix #13360
---
 plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c b/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c
index 14c85cc..df00f99 100644
--- a/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c
+++ b/plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c
@@ -144,6 +144,7 @@ pixbuf_thumbnailer_new_from_stream (GInputStream      *stream,
   GdkPixbufLoader *loader;
   gssize           n_read;
   gboolean         result;
+  gboolean         loader_write_error;
   GdkPixbuf       *src;
   GdkPixbuf       *pixbuf = NULL;
   guchar           buffer[65536];
@@ -157,6 +158,7 @@ pixbuf_thumbnailer_new_from_stream (GInputStream      *stream,
       G_CALLBACK (pixbuf_thumbnailer_size_prepared), thumbnail);
 
   result = TRUE;
+  loader_write_error = FALSE;
   for (;;)
     {
       n_read = g_input_stream_read (stream, buffer, sizeof (buffer),
@@ -175,12 +177,14 @@ pixbuf_thumbnailer_new_from_stream (GInputStream      *stream,
       if (!gdk_pixbuf_loader_write (loader, buffer, n_read, error))
         {
           result = FALSE;
+          loader_write_error = TRUE;
           error = NULL; /* ignore further errors in this function */
           break;
         }
     }
 
-  if (!gdk_pixbuf_loader_close (loader, error))
+  /* only close the pixbuf loader if no error has occured */
+  if (!loader_write_error && !gdk_pixbuf_loader_close (loader, error))
     {
       result = FALSE;
       error = NULL; /* ignore further errors in this function */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list