diff options
author | Bastien Nocera <hadess@hadess.net> | 2016-12-28 18:13:38 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2016-12-28 18:29:18 +0100 |
commit | 201079960809a9ca9aa2552c3433fce94e851b00 (patch) | |
tree | 823324cbc01e33b47d8fc9390cdede6670cfcac2 /tests | |
parent | 39a31870177bb06162c3cd1a8d0dbb3571ee3c0b (diff) | |
download | gdk-pixbuf-201079960809a9ca9aa2552c3433fce94e851b00.tar.gz |
tests: Fix a couple of mistakes in pixbuf-save-ref
Fix incorrect _close()/_get_pixbuf() call order, a possible
g_object_unref() on a NULL pixbuf, and handling of GIF animations.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pixbuf-save-ref.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/pixbuf-save-ref.c b/tests/pixbuf-save-ref.c index e805c139b..253d9ab5c 100644 --- a/tests/pixbuf-save-ref.c +++ b/tests/pixbuf-save-ref.c @@ -25,7 +25,7 @@ static gboolean load_and_save (const char *filename, GError **error) { - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf = NULL; GdkPixbufLoader *loader; guchar *contents; char *new_filename = NULL; @@ -42,15 +42,20 @@ load_and_save (const char *filename, GError **error) goto out; } + if (!gdk_pixbuf_loader_close (loader, error)) + { + if (!g_error_matches (*error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INCOMPLETE_ANIMATION)) + { + ret = FALSE; + goto out; + } + g_clear_error (error); + } + pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); g_assert (pixbuf); g_object_ref (pixbuf); - if (!gdk_pixbuf_loader_close (loader, error)) - { - ret = FALSE; - goto out; - } g_object_unref (loader); new_filename = g_strdup_printf ("%s.ref.png", filename); @@ -59,7 +64,7 @@ load_and_save (const char *filename, GError **error) out: g_free (contents); g_free (new_filename); - g_object_unref (pixbuf); + g_clear_object (&pixbuf); return ret; } |