[gimp] Issue #1634 - PNG image opens as a blank one in GIMP



commit db08271d16f72a6e27134926a2678689db84fd0b
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jun 13 19:06:27 2018 +0200

    Issue #1634 - PNG image opens as a blank one in GIMP
    
    Set the libpng error_fn to NULL *after* png_read_end() not before.
    png_read_end() can throw errors and we recover what's partially loaded
    from an image in the error handler.

 plug-ins/common/file-png.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index a287f2f7f2..da2116b69f 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -765,7 +765,7 @@ on_read_error (png_structp     png_ptr,
   gint                    end;
   gint                    num;
 
-  g_warning (_("Error loading PNG file: %s"), error_msg);
+  g_printerr (_("Error loading PNG file: %s\n"), error_msg);
 
   /* Flush the current half-read row of tiles */
 
@@ -1271,11 +1271,11 @@ load_image (const gchar  *filename,
         }
     }
 
+  png_read_end (pp, info);
+
   /* Switch back to default error handler */
   png_set_error_fn (pp, NULL, NULL, NULL);
 
-  png_read_end (pp, info);
-
   if (png_get_text (pp, info, &text, &num_texts))
     {
       gchar *comment = NULL;


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