[gimp] app: properly report thumbnail creation errors.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: properly report thumbnail creation errors.
- Date: Wed, 9 Feb 2022 21:59:48 +0000 (UTC)
commit 5aae429cd6447a0e1d2f8448370a1b02ca6005ca
Author: Jehan <jehan girinstud io>
Date: Wed Feb 9 22:20:27 2022 +0100
app: properly report thumbnail creation errors.
There were some comments claiming we don't care about thumbnail creation
errors, only thumbnail saving. It's not true. Thumbnail creation errors
are probably even more important (in this specific usage). For instance,
trying to debug a thumbnail load procedure, I had no clue on the error
even though our system was able to report the issue. It's not cool for
plug-in developers.
Now we will check the thumbnail creation error, write down the error
message on stderr and clear the error for the fallback round (using the
normal file load proc). Then if it errors out again, we will keep this
error as the finale one because it's probably more important if we can't
even open images than the unrelated thumbnail saving error. We will
still return the saving error if the load proc failed without error.
app/core/gimpimagefile.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c
index 703d8ceaf3..fa43cec934 100644
--- a/app/core/gimpimagefile.c
+++ b/app/core/gimpimagefile.c
@@ -464,13 +464,10 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
g_object_ref (imagefile);
- /* don't pass the error, we're only interested in errors from
- * actual thumbnail saving
- */
image = file_open_thumbnail (private->gimp, context, progress,
private->file, size,
&mime_type, &width, &height,
- &format, &num_layers, NULL);
+ &format, &num_layers, error);
if (image)
{
@@ -482,13 +479,18 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
{
GimpPDBStatusType status;
- /* don't pass the error, we're only interested in errors
- * from actual thumbnail saving
- */
+ if (error && *error)
+ {
+ g_printerr ("Info: Thumbnail load procedure failed: %s\n"
+ " Falling back to file load procedure.\n",
+ (*error)->message);
+ g_clear_error (error);
+ }
+
image = file_open_image (private->gimp, context, progress,
private->file,
FALSE, NULL, GIMP_RUN_NONINTERACTIVE,
- &status, &mime_type, NULL);
+ &status, &mime_type, error);
if (image)
gimp_thumbnail_set_info_from_image (private->thumbnail,
@@ -505,10 +507,16 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
}
else
{
- success = gimp_thumbnail_save_failure (thumbnail,
- "GIMP " GIMP_VERSION,
- error);
+ /* If the error object is already set (i.e. we have an error
+ * message for why the thumbnail creation failed), this is the
+ * error we want to return. Ignore any error from failed
+ * thumbnail saving.
+ */
+ gimp_thumbnail_save_failure (thumbnail,
+ "GIMP " GIMP_VERSION,
+ error && *error ? NULL : error);
gimp_imagefile_update (imagefile);
+ success = FALSE;
}
g_object_unref (imagefile);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]