color-lcms: clean up context in init failure
This is not strictly necessary, because if init fails, then weston_compositor_backends_loaded() fails, main.c will weston_compositor_destroy() -> weston_compositor_shutdown() -> cmclcms_destroy() which will free this. But that is very hard to track down, so let's make the code obviously more correct. We must also avoid cmsDeleteContext(NULL), because it will then do something to the default cms context rather than bail out. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
80c0d5e643
commit
61b3ae335a
|
@ -437,6 +437,10 @@ cmlcms_init(struct weston_color_manager *cm_base)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
out_err:
|
out_err:
|
||||||
|
if (cm->lcms_ctx)
|
||||||
|
cmsDeleteContext(cm->lcms_ctx);
|
||||||
|
cm->lcms_ctx = NULL;
|
||||||
|
|
||||||
weston_log_scope_destroy(cm->transforms_scope);
|
weston_log_scope_destroy(cm->transforms_scope);
|
||||||
cm->transforms_scope = NULL;
|
cm->transforms_scope = NULL;
|
||||||
weston_log_scope_destroy(cm->optimizer_scope);
|
weston_log_scope_destroy(cm->optimizer_scope);
|
||||||
|
@ -480,7 +484,8 @@ cmlcms_destroy(struct weston_color_manager *cm_base)
|
||||||
assert(wl_list_empty(&cm->color_transform_list));
|
assert(wl_list_empty(&cm->color_transform_list));
|
||||||
assert(wl_list_empty(&cm->color_profile_list));
|
assert(wl_list_empty(&cm->color_profile_list));
|
||||||
|
|
||||||
cmsDeleteContext(cm->lcms_ctx);
|
if (cm->lcms_ctx)
|
||||||
|
cmsDeleteContext(cm->lcms_ctx);
|
||||||
|
|
||||||
weston_log_scope_destroy(cm->transforms_scope);
|
weston_log_scope_destroy(cm->transforms_scope);
|
||||||
weston_log_scope_destroy(cm->optimizer_scope);
|
weston_log_scope_destroy(cm->optimizer_scope);
|
||||||
|
|
Loading…
Reference in New Issue