libgimpwidgets: fix segfaults on wrongly handled referencing.

gimp_color_config_get_simulation_color_profile() is returning a new
object, so we had 2 code paths giving either allocated data or not.

Therefore simply ref the passed softproof profile in the second code
path, and don't ref it anymore when caching it (especially as it might
also be NULL at that point).
This commit is contained in:
Jehan 2022-07-18 14:33:42 +02:00
parent d0dd97cbc2
commit 6a08fd6596

View file

@ -901,7 +901,7 @@ gimp_widget_get_color_transform (GtkWidget *widget,
proof_profile = gimp_color_config_get_simulation_color_profile (config,
NULL);
else
proof_profile = softproof_profile;
proof_profile = g_object_ref (softproof_profile);
/* fallthru */
case GIMP_COLOR_MANAGEMENT_DISPLAY:
@ -947,7 +947,7 @@ gimp_widget_get_color_transform (GtkWidget *widget,
cache->src_format = src_format;
cache->dest_profile = dest_profile;
cache->dest_format = dest_format;
cache->proof_profile = g_object_ref (proof_profile);
cache->proof_profile = proof_profile;
cache->notify_id =
g_signal_connect (cache->config, "notify",