summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-06-07 14:19:31 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-06-07 14:19:31 -0400
commit570a8f967cb7c315c4f9746a9094b4b1fc9c8611 (patch)
treee19e249f4fec9c1a97155142770f14b66f2d91d3
parent7d649a6b480c22fdda23225b42bcfbbc5485b0ca (diff)
downloadgdk-pixbuf-570a8f967cb7c315c4f9746a9094b4b1fc9c8611.tar.gz
ANI: Set an error if we fail to produce an animation
Otherwise we trip up an assertion in gdk_pixbuf_animation_new_from_file.
-rw-r--r--gdk-pixbuf/io-ani.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c
index 6e72948a1..48752fa62 100644
--- a/gdk-pixbuf/io-ani.c
+++ b/gdk-pixbuf/io-ani.c
@@ -612,6 +612,7 @@ gdk_pixbuf__ani_image_begin_load (GdkPixbufModuleSizeFunc size_func,
context->byte = context->buffer;
context->n_bytes = 0;
+g_print ("begin load\n");
return (gpointer) context;
}
@@ -620,11 +621,22 @@ gdk_pixbuf__ani_image_stop_load (gpointer data,
GError **error)
{
AniLoaderContext *context = (AniLoaderContext *) data;
-
+ gboolean retval;
+
g_return_val_if_fail (context != NULL, TRUE);
+ if (!context->animation) {
+ g_set_error_literal (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("ANI image was truncated or incomplete."));
+ retval = FALSE;
+ }
+ else {
+ retval = TRUE;
+ }
context_free (context);
-
- return TRUE;
+
+ return retval;
}
#ifndef INCLUDE_ani