[gimp] Issue #3070: CRITICAL when converting to Indexed image.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #3070: CRITICAL when converting to Indexed image.
- Date: Wed, 17 Jul 2019 10:46:21 +0000 (UTC)
commit 786686a5415526814eb9f7bc004cca591ce3e282
Author: Jehan <jehan girinstud io>
Date: Wed Jul 17 12:14:10 2019 +0200
Issue #3070: CRITICAL when converting to Indexed image.
Fixes the GIMP-CRITICAL:
> gimp_babl_format_get_trc: assertion 'format != NULL' failed".
During an indexed conversion, we are in a weird limbo state between the
time we changed the base-type to GIMP_INDEXED and when we actually set
the new palette. If during this time, we hit a context switch (which
typically happens during GUI code; in this specific cases, the various
progress updates would call gimp_widget_flush_expose() which does
trigger context switch), then gimp_display_shell_update_title_idle()
might be idly called. And when it does, it sees an indexed function with
neither format nor builtin profile.
app/display/gimpdisplayshell-title.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index 6078222f3c..b6cf541dd9 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -81,16 +81,28 @@ static gboolean
gimp_display_shell_update_title_idle (gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
+ GimpImage *image;
shell->title_idle_id = 0;
- if (gimp_display_get_image (shell->display))
+ image = gimp_display_get_image (shell->display);
+ if (image)
{
GimpDisplayConfig *config = shell->display->config;
gchar title[MAX_TITLE_BUF];
gchar status[MAX_TITLE_BUF];
gint len;
+ /* This is a ugly hack to prevent this function to be called while
+ * an image is being converted to indexed (which may happen as
+ * various context switch happen during progress update). In such
+ * edge case, we end up in an in-between time where the image is
+ * seamingly broken as it has no format (hence no profile either).
+ */
+ if (gimp_image_get_base_type (image) == GIMP_INDEXED &&
+ ! gimp_image_get_layer_format (image, FALSE))
+ return FALSE;
+
/* format the title */
len = gimp_display_shell_format_title (shell, title, sizeof (title),
config->image_title_format);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]