From f555997af96ff8ee1b929f57571d0106325615ac Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Fri, 6 Oct 2023 17:23:26 +0200 Subject: [PATCH 1/2] histogram: Fix a memory leak. --- src/libs/histogram.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/histogram.c b/src/libs/histogram.c index 59cc1fadca42..a20869c9af8d 100644 --- a/src/libs/histogram.c +++ b/src/libs/histogram.c @@ -250,7 +250,10 @@ dt_view_type_flags_t views(dt_lib_module_t *self) uint32_t container(dt_lib_module_t *self) { - return g_strcmp0(dt_conf_get_string("plugins/darkroom/histogram/panel_position"), "right") ? DT_UI_CONTAINER_PANEL_LEFT_TOP : DT_UI_CONTAINER_PANEL_RIGHT_TOP; + return g_strcmp0 + (dt_conf_get_string_const("plugins/darkroom/histogram/panel_position"), "right") + ? DT_UI_CONTAINER_PANEL_LEFT_TOP + : DT_UI_CONTAINER_PANEL_RIGHT_TOP; } int expandable(dt_lib_module_t *self) From 461d707195f01b30a32d0f471d8e1942112e3b49 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Fri, 6 Oct 2023 17:35:36 +0200 Subject: [PATCH 2/2] histogram: avoid dereferencing null profile pointer. Also add a on-display log information about the profile being replaced by Rec2020. Fixes #15370. --- src/libs/histogram.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libs/histogram.c b/src/libs/histogram.c index a20869c9af8d..92372e834bab 100644 --- a/src/libs/histogram.c +++ b/src/libs/histogram.c @@ -775,9 +775,15 @@ static void _lib_histogram_process_vectorscope if(!vs_prof || !dt_is_valid_colormatrix(vs_prof->matrix_in[0][0])) { dt_print(DT_DEBUG_ALWAYS, - "[histogram] unsupported vectorscope profile %i %s, it will be replaced with linear Rec2020\n", - vs_prof->type, vs_prof->filename); - vs_prof = dt_ioppr_add_profile_info_to_list(darktable.develop, DT_COLORSPACE_LIN_REC2020, "", DT_INTENT_RELATIVE_COLORIMETRIC); + "[histogram] unsupported vectorscope profile %i %s," + " it will be replaced with linear Rec2020\n", + vs_prof ? vs_prof->type : 0, + vs_prof ? vs_prof->filename : "unsupported"); + dt_control_log(_("unsupported vectorscope profile selected," + " it will be replaced with linear Rec2020")); + vs_prof = dt_ioppr_add_profile_info_to_list + (darktable.develop, + DT_COLORSPACE_LIN_REC2020, "", DT_INTENT_RELATIVE_COLORIMETRIC); } _lib_histogram_vectorscope_bkgd(d, vs_prof);