2.99 core: crash, script calling (gimp-drawable-fill FILL-CIELAB-MIDDLE-GRAY)
Environment/Versions
- GIMP version: latest
- Package: self-built
- Operating System: Linux
Description of the bug
Core crashes when a test script runs:
In the terminal stderr:
(script-fu:4007): scriptfu-DEBUG: 14:27:09.930: calling gimp-drawable-fill
26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory.
26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory.
26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory.
../babl/babl-fish.c:205 babl_fish()
Eeeeek! Assertion failed: `destination`
gimp-2.99: ../babl/babl-fish.c:205: babl_fish: Assertion `destination' failed.
/usr/local/bin/gimp-2.99: fatal error: Aborted
26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory.
(script-fu:4007): LibGimpBase-WARNING **: 14:27:13.354: script-fu: gimp_wire_read(): error
(script-fu:3955): LibGimpBase-WARNING **: 14:27:13.354: script-fu: gimp_wire_read(): error
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Open SF Console
- Enter: (testing:load-test "drawable-ops.scm")
Expected result: not crash
Actual result: crash, as above.
Additional information
In gdb, bt after the crash:
#6 0x00007ffff6239186 in __assert_fail
(assertion=0x7ffff74f8808 "destination", file=0x7ffff74f87c3 "../babl/babl-fish.c", line=205, function=0x7ffff74f8870 <__PRETTY_FUNCTION__.1> "babl_fish")
at ./assert/assert.c:101
#7 0x00007ffff74aa1c1 in babl_fish (source=0x555555d18950, destination=0x0) at ../babl/babl-fish.c:205
#8 0x00005555556a95c5 in gimp_get_fill_params
(context=context@entry=0x555558ee6010, fill_type=fill_type@entry=GIMP_FILL_CIELAB_MIDDLE_GRAY, color=color@entry=0x7fffffffe5e0, pattern=pattern@entry=0x7fffffffe5d8, error=error@entry=0x0) at ../gimp/app/core/gimp-utils.c:568
#9 0x00005555556c29ac in gimp_drawable_fill
(drawable=drawable@entry=0x555558f24670, context=context@entry=0x555558ee6010, fill_type=fill_type@entry=GIMP_FILL_CIELAB_MIDDLE_GRAY)
at ../gimp/app/core/gimpdrawable-fill.c:70
#10 0x0000555555755ad7 in drawable_fill_invoker
(procedure=0x5555560d5620, gimp=<optimized out>, context=0x555558ee6010, progress=<optimized out>, args=<optimized out>, error=0x7fffffffe708)
at ../gimp/app/pdb/drawable-cmds.c:648
#11 0x00005555557b1e73 in gimp_procedure_execute
Discussion
The test script is one that I am developing (checking it into the repo imminent.) The test script opens wilber.png and calls a sequence of gimp-drawable-foo operations. It crashes when it gets to (gimp-drawable-fill 2 FILL-CIELAB-MIDDLE-GRAY). The sequence is somewhat arbitrary, not with any intent except to test. I don't know that other sequences crash. If you open Wilber.png in the app and then enter the same sequence in the SF Console, line at a time, it doesn't crash, I presume because then there is an image in context (see below.)
In app/core/gimputils.c line 564
case GIMP_FILL_CIELAB_MIDDLE_GRAY:
{
const float cielab_pixel[3] = {50, 0, 0};
float pixel[3] = {0, 0, 0};
GimpImage *image = gimp_context_get_image (context);
GimpImageBaseType base_type;
const Babl *format;
base_type = gimp_image_get_base_type (image);
if (base_type == GIMP_INDEXED)
base_type = GIMP_RGB;
format = gimp_image_get_format (image, base_type,
GIMP_PRECISION_FLOAT_NON_LINEAR, FALSE,
gimp_image_get_layer_space (image));
babl_process (babl_fish (babl_format ("CIE Lab float"), format),
cielab_pixel, pixel, 1);
gimp_rgba_set (color, pixel[0], pixel[1], pixel[2], GIMP_OPACITY_OPAQUE);
}
the code assumes that gimp_context_get_image returns a non-null image, but apparently it doesn't (when I harnessed the code, it returned NULL.) I don't understand what the image in context is, maybe the image whose tab is visible i.e. the "selected" one? Maybe the code should get the image from the drawable?
Possibly related to #10424 found by searching issues for gimp_drawable_fill. But probably not, unless GIMP_FILL_CIELAB_MIDDLE_GRAY is a default.