[gdk-pixbuf] animation: Allow prepare_func call in stop_load



commit ff7e0f385b4c3f63b43b474a0a43e975c1881ebb
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 12 21:41:34 2013 +0100

    animation: Allow prepare_func call in stop_load
    
    Move the assertion that prepare_func was called after the stop_load
    call. Makes the XPM loader not die.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695228

 gdk-pixbuf/gdk-pixbuf-animation.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c
index e39a592..911bf41 100644
--- a/gdk-pixbuf/gdk-pixbuf-animation.c
+++ b/gdk-pixbuf/gdk-pixbuf-animation.c
@@ -238,8 +238,6 @@ gdk_pixbuf_animation_new_from_file (const char *filename,
                         }
                 }
 
-                /* If there was no error, there must be an animation that was successfully loaded */
-                g_assert (animation);
                 success = TRUE;
 
 fail_load_increment:
@@ -249,9 +247,14 @@ fail_load_increment:
 fail_begin_load:
                fclose (f);
 
-                if (!success && animation) {
-                        g_object_unref (animation);
-                        animation = NULL;
+                if (success) {
+                        /* If there was no error, there must be an animation that was successfully loaded */
+                        g_assert (animation);
+                } else {
+                        if (animation) {
+                                g_object_unref (animation);
+                                animation = NULL;
+                        }
                 }
        } else {
                GdkPixbuf *pixbuf;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]