plug-ins: ico export crashes on indexed images.

It seems the current code simply forgot to break on indexed types and
therefore hit some g_return_*if_reached() code breaking the logics.
Looking further, I see some code taking care of indexed images and
converting them to RGB. And testing after adding breaks looks like it
works just fine.
So I am assuming this was just forgotten breaks indeed, and not on
purpose not allowing indexed images (if that were the intent though,
this is not how it should be done).
This commit is contained in:
Jehan 2018-02-05 15:00:17 +01:00
parent 534e5971fc
commit 42eaf588fd
2 changed files with 6 additions and 0 deletions

View file

@ -258,6 +258,7 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
case GIMP_INDEXED_IMAGE:
case GIMP_INDEXEDA_IMAGE:
format = gimp_drawable_get_format (layer);
break;
default:
g_return_if_reached ();

View file

@ -464,6 +464,10 @@ ico_get_layer_num_colors (gint32 layer,
case GIMP_INDEXED_IMAGE:
case GIMP_INDEXEDA_IMAGE:
format = gegl_buffer_get_format (buffer);
/* It is possible to count the colors of indexed image more easily
* with gimp_image_get_colormap(), but counting only the colors
* actually used will allow more efficient bpp if possible. */
break;
default:
g_return_val_if_reached (0);
@ -599,6 +603,7 @@ ico_image_get_reduced_buf (guint32 layer,
case GIMP_INDEXED_IMAGE:
case GIMP_INDEXEDA_IMAGE:
format = gegl_buffer_get_format (buffer);
break;
default:
g_return_if_reached ();