diff options
author | Ali Abdallah <ali@xfce.org> | 2017-06-07 09:51:34 +0200 |
---|---|---|
committer | Ali Abdallah <ali@xfce.org> | 2017-06-07 09:51:34 +0200 |
commit | 984e67ce5247a2543f0fd547b42201043c69e9b2 (patch) | |
tree | b73c26e3ae9efc5b55cf7b325d814dceb9feb256 | |
parent | e650eda2282b870580d00408bc2a96337e8de544 (diff) | |
download | tumbler-984e67ce5247a2543f0fd547b42201043c69e9b2.tar.gz |
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
-rw-r--r-- | plugins/pixbuf-thumbnailer/pixbuf-thumbnailer.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 */ |