summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartinsifrar <53146732+martinsifrar@users.noreply.github.com>2024-04-15 12:56:09 +0200
committerGitHub <noreply@github.com>2024-04-15 12:56:09 +0200
commit4f098751cd8a328e5b8d034113aae1420fee1c8d (patch)
tree1163ef463eceefc63994e70f1081b803f2346e7a
parent6c38a49d543633e736d4e1653c0b02fe29e46ffd (diff)
[IconFetcher] Fix failing decode of animated GIFs. (#1975)
-rw-r--r--source/rofi-icon-fetcher.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/rofi-icon-fetcher.c b/source/rofi-icon-fetcher.c
index ef19bf5f..106f8f10 100644
--- a/source/rofi-icon-fetcher.c
+++ b/source/rofi-icon-fetcher.c
@@ -365,6 +365,17 @@ static void rofi_icon_fetcher_worker(thread_state *sdata,
GError *error = NULL;
GdkPixbuf *pb = gdk_pixbuf_new_from_file_at_scale(
icon_path, sentry->wsize, sentry->hsize, TRUE, &error);
+
+ /*
+ * 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_scale
+ * 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);
+ }
+
if (error != NULL) {
g_warning("Failed to load image: |%s| %d %d %s (%p)", icon_path,
sentry->wsize, sentry->hsize, error->message, (void *)pb);