mirror of https://github.com/GNOME/gimp.git
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:
parent
c42baf6676
commit
db08271d16
|
@ -765,7 +765,7 @@ on_read_error (png_structp png_ptr,
|
||||||
gint end;
|
gint end;
|
||||||
gint num;
|
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 */
|
/* 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 */
|
/* Switch back to default error handler */
|
||||||
png_set_error_fn (pp, NULL, NULL, NULL);
|
png_set_error_fn (pp, NULL, NULL, NULL);
|
||||||
|
|
||||||
png_read_end (pp, info);
|
|
||||||
|
|
||||||
if (png_get_text (pp, info, &text, &num_texts))
|
if (png_get_text (pp, info, &text, &num_texts))
|
||||||
{
|
{
|
||||||
gchar *comment = NULL;
|
gchar *comment = NULL;
|
||||||
|
|
Loading…
Reference in New Issue