1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

[IconFetcher] Fix failing decode of animated GIFs. (#1975)

This commit is contained in:
martinsifrar 2024-04-15 12:56:09 +02:00 committed by GitHub
parent 6c38a49d54
commit 4f098751cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);