1
0
Fork 0

color-device: Make sure lcms_context is not NULL

lcms interprets a NULL context as using a default, non-thread-safe
context, which is unsuitable for mutter's use. Make sure we're always
using a non-trivial context.

Helps: https://gitlab.gnome.org/GNOME/mutter/-/issues/2659
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2877>
This commit is contained in:
Simon McVittie 2023-03-01 10:12:03 +00:00 committed by Marge Bot
parent f447c0df18
commit e2be2d271b

View file

@ -846,6 +846,14 @@ create_icc_profile_from_edid (MetaColorDevice *color_device,
return NULL; return NULL;
} }
lcms_context = meta_color_manager_get_lcms_context (color_manager);
if (!lcms_context)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Internal error: no LCMS context available");
return NULL;
}
cd_icc = cd_icc_new (); cd_icc = cd_icc_new ();
chroma.Red.x = edid_info->red_x; chroma.Red.x = edid_info->red_x;
@ -863,7 +871,6 @@ create_icc_profile_from_edid (MetaColorDevice *color_device,
transfer_curve[1] = transfer_curve[0]; transfer_curve[1] = transfer_curve[0];
transfer_curve[2] = transfer_curve[0]; transfer_curve[2] = transfer_curve[0];
lcms_context = meta_color_manager_get_lcms_context (color_manager);
lcms_profile = cmsCreateRGBProfileTHR (lcms_context, lcms_profile = cmsCreateRGBProfileTHR (lcms_context,
&white_point, &white_point,
&chroma, &chroma,