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.
This commit is contained in:
parent
74abdfa377
commit
786686a541
1 changed files with 13 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue