diff options
author | Debarshi Ray <debarshir@gnome.org> | 2018-12-12 18:57:27 +0100 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2018-12-14 13:39:35 +0100 |
commit | f59d1d177f641562f44915401577d22569ed2a8c (patch) | |
tree | 68f6815b32b0f1da60d0b696cb65ee8e91632012 /thumbnailer | |
parent | d1d8b5f9065f5d4a1d7ca0a0e298db9f5c5d256a (diff) | |
download | gdk-pixbuf-f59d1d177f641562f44915401577d22569ed2a8c.tar.gz |
thumbnailer: Unbreak thumbnailing of GIFs
The GIF codec throws GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION if it's
closed without decoding all the frames. The thumbnailer has always,
both now with gdk_pixbuf_new_from_file_at_scale and earlier, decoded
only the first animation frame, which is why this specific error needs
to be ignored [1].
Fixes: dd1f222f78eed2b7d70a5e8507199c78e3f9e12b
[1] https://gitlab.gnome.org/GNOME/gnome-desktop/commit/f9b2c480e38d
https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/99
Diffstat (limited to 'thumbnailer')
-rw-r--r-- | thumbnailer/gdk-pixbuf-thumbnailer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/thumbnailer/gdk-pixbuf-thumbnailer.c b/thumbnailer/gdk-pixbuf-thumbnailer.c index d50ede8ee..8308ecaf7 100644 --- a/thumbnailer/gdk-pixbuf-thumbnailer.c +++ b/thumbnailer/gdk-pixbuf-thumbnailer.c @@ -36,6 +36,14 @@ file_to_pixbuf (const char *path, if (pixbuf == NULL) return NULL; + /* The GIF codec throws GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION + * if it's closed without decoding all the frames. Since + * gdk_pixbuf_new_from_file_at_size only decodes the first + * frame, this specific error needs to be ignored. + */ + if (error != NULL && g_error_matches (*error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION)) + g_clear_error (error); + tmp_pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf); gdk_pixbuf_copy_options (pixbuf, tmp_pixbuf); gdk_pixbuf_remove_option (tmp_pixbuf, "orientation"); |