From a27efd5ad8b4d73b235bdfaa72ef63953304e35f Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 17 Apr 2026 14:02:24 +0300 Subject: [PATCH] color: dissolve cm_image_desc_destroy() The only legal way to destroy a cm_image_desc is to go through the wl_resource destruction. Calling the function otherwise would have left a dangling pointer in the resource. Let's not have the temptation to "fix" that dangling pointer. Signed-off-by: Pekka Paalanen --- libweston/color-management.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/libweston/color-management.c b/libweston/color-management.c index 671c90052..bc344d962 100644 --- a/libweston/color-management.c +++ b/libweston/color-management.c @@ -423,9 +423,6 @@ image_description_destroy(struct wl_client *client, wl_resource_destroy(cm_image_desc_res); } -static void -cm_image_desc_destroy(struct cm_image_desc *cm_image_desc); - /** * Resource destruction function for the image description. Destroys the image * description backing object. @@ -441,7 +438,8 @@ image_description_resource_destroy(struct wl_resource *cm_image_desc_res) if (!cm_image_desc) return; - cm_image_desc_destroy(cm_image_desc); + weston_color_profile_unref(cm_image_desc->cprof); + free(cm_image_desc); } static const struct wp_image_description_v1_interface @@ -499,16 +497,6 @@ link_image_description_resource(struct weston_color_manager *cm, cm_image_desc->cprof->id); } -/** - * Destroy an image description object. - */ -static void -cm_image_desc_destroy(struct cm_image_desc *cm_image_desc) -{ - weston_color_profile_unref(cm_image_desc->cprof); - free(cm_image_desc); -} - /** * Called by clients when they want to get the output's image description. */