diff options
author | Leandro Ribeiro <leandro.ribeiro@collabora.com> | 2023-10-27 12:09:59 -0300 |
---|---|---|
committer | Pekka Paalanen <pq@iki.fi> | 2023-10-30 11:47:35 +0000 |
commit | 39de0bd9887ecb0df9c3565af8b09ada73ab00c1 (patch) | |
tree | 8148407f004f62e123a8e9331d39454c09eb3afa | |
parent | d18fd64a158a9c1b543ccd9a56f7f7e18d1cd733 (diff) |
color-lcms: unref stock sRGB cprof instead of directly destroying it
Directly destroying the cprof is not ideal, because it may hide issues
that we have in the code. If we are destroying a cprof with ref_count
bigger than 1, there's something wrong that we need to fix.
Instead, assert that the stock sRGB cprof has ref_count == 1 when we are
destroying the color manager. And use unref() instead of destroy().
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
-rw-r--r-- | libweston/color-lcms/color-lcms.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libweston/color-lcms/color-lcms.c b/libweston/color-lcms/color-lcms.c index 656acd4a..ba8e404f 100644 --- a/libweston/color-lcms/color-lcms.c +++ b/libweston/color-lcms/color-lcms.c @@ -381,8 +381,11 @@ cmlcms_destroy(struct weston_color_manager *cm_base) { struct weston_color_manager_lcms *cm = get_cmlcms(cm_base); - if (cm->sRGB_profile) - cmlcms_color_profile_destroy(cm->sRGB_profile); + if (cm->sRGB_profile) { + assert(cm->sRGB_profile->base.ref_count == 1); + unref_cprof(cm->sRGB_profile); + } + assert(wl_list_empty(&cm->color_transform_list)); assert(wl_list_empty(&cm->color_profile_list)); |