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.
This commit is contained in:
Michael Natterer 2018-06-13 19:06:27 +02:00
parent c42baf6676
commit db08271d16
1 changed files with 3 additions and 3 deletions

View File

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