Skip to content

Conversation

@jenshannoschwalm
Copy link
Collaborator

While falling back to lab jzczhz blending we should check

  • if there is a profile defined
  • and if the corresponding input profile could be created.

If not, we can't do anything here and just leave out blending.

Should fix #19968

@MStraeten could you check?

@jenshannoschwalm jenshannoschwalm added the bugfix pull request fixing a bug label Dec 22, 2025
@jenshannoschwalm jenshannoschwalm modified the milestones: 5.6, 5.4.1 Dec 22, 2025
@MStraeten
Copy link
Collaborator

unfortunately the check for the profile doesn't help.
running darktable in a debugger indcates, that profile is set an contains the filename of the now missing icc file.

Bildschirmfoto 2025-12-22 um 15 37 03

@jenshannoschwalm
Copy link
Collaborator Author

@MStraeten could you test again (all squashed in one commit) ?

BTW - could you provide the profile file?

@MStraeten
Copy link
Collaborator

issue no longer exists with this pr
Its a quite old edit with an old icc file - if it's available then it's handled properly 20190321-5DmIV.icc.txt

@jenshannoschwalm
Copy link
Collaborator Author

Sorry to bother you but the latest force-pushed version tests for "icc file existing" at the proper place.

Copy link
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit
Copy link
Member

I'll wait for @MStraeten second testing round before merging. TIA.

@MStraeten
Copy link
Collaborator

the latest push breaks it again:

image
Process 91583 stopped
* thread #29, name = 'worker res 0', stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006e9800000, mask=0x00000006ed800000, stride=2176, blendif=256, parameters=0x000000017292c080, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #62, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006e9b27800, mask=0x00000006ed8c9e00, stride=2176, blendif=256, parameters=0x000000017852a980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #63, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006e9e4f000, mask=0x00000006ed993c00, stride=2176, blendif=256, parameters=0x0000000178d32980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #64, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006ea176800, mask=0x00000006eda5da00, stride=2176, blendif=256, parameters=0x000000017953a980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #65, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006ea49e000, mask=0x00000006edb27800, stride=2176, blendif=256, parameters=0x0000000179d42980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #66, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006ea7c5800, mask=0x00000006edbf1600, stride=2176, blendif=256, parameters=0x000000017a54a980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #67, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006eaaed000, mask=0x00000006edcbb400, stride=2176, blendif=256, parameters=0x000000017ad52980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #68, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006eae0c000, mask=0x00000006edd83000, stride=2176, blendif=256, parameters=0x000000017b55a980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #69, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006eb12b000, mask=0x00000006ede4ac00, stride=2176, blendif=256, parameters=0x000000017bd62980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
  thread #70, stop reason = EXC_BAD_ACCESS (code=1, address=0x408)
    frame #0: 0x0000000100865b5c libdarktable.dylib`_blendif_combine_channels(pixels=0x00000006eb44a000, mask=0x00000006edf12800, stride=2176, blendif=256, parameters=0x000000017c56a980, profile=0x000000017292c700) at blendif_rgb_jzczhz.c:245:115 [opt]
   242 	                    invert_mask, profile);
   243 	    else if(profile)
   244 	    {
-> 245 	      cmsHPROFILE *input = dt_colorspaces_get_profile(profile->type, profile->filename, DT_PROFILE_DIRECTION_IN)->profile;
   246 	      cmsHPROFILE *Lab = dt_colorspaces_get_profile(DT_COLORSPACE_LAB, "", DT_PROFILE_DIRECTION_ANY)->profile;
   247 	      cmsHTRANSFORM *xform = input ? cmsCreateTransform(input, TYPE_RGBA_FLT, Lab, TYPE_LabA_FLT, profile->intent, 0) : NULL;
   248
Target 0: (darktable) stopped.

@jenshannoschwalm
Copy link
Collaborator Author

Very interesting. It seems the list is not correct. Will further investigate ...

We maintain a global list of all profiles while committing params via _ioppr_generate_profile_info().
In case of icc file profiles we didn't test for the file being available and missed to return that as
an error condition. We now test & log such error conditions.

The colorin & colorout modules handled this "gracefully" already but since introducing the fallback to
lab blending this resulted in a crash while traversing the list.

While being here added info about missing matrix and nonlinearlut in the log.
If we set input,output or work profile to a icc file profile we should report if the file
was not available and report that.
This is only done while calculating preview pipe to avoid repeating messages.
@jenshannoschwalm jenshannoschwalm changed the title Check for available lab profile Check for available icc file profiles Dec 23, 2025
@jenshannoschwalm
Copy link
Collaborator Author

@TurboGit and @MStraeten

Found the issue leading to crashes while traversing the list. It was basically a missing test for existance of icc files resulting in a bad list.

1st commit would be for 5.4.1 and master
2nd commit reporting via control log for master

@MStraeten
Copy link
Collaborator

thats it, it properly reports the missing icc file
thanks for the fix

@jenshannoschwalm jenshannoschwalm added the priority: high core features are broken and not usable at all, software crashes label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug priority: high core features are broken and not usable at all, software crashes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crash in blendif_rgb_jzczhz.c due to missing icc file

3 participants