[gimp] modules: fix memory leaks in color-selector-cmyk.c
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] modules: fix memory leaks in color-selector-cmyk.c
- Date: Sun, 16 Mar 2014 14:58:38 +0000 (UTC)
commit 251dd91395d5d3b99ab799b6711189012534634d
Author: Michael Natterer <mitch gimp org>
Date: Sat Mar 15 23:56:03 2014 +0100
modules: fix memory leaks in color-selector-cmyk.c
Also clean up a bit and make the profile label's tooltip show
the profile's summary.
modules/color-selector-cmyk.c | 35 ++++++++++++++++++++++++-----------
1 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/modules/color-selector-cmyk.c b/modules/color-selector-cmyk.c
index 10817cb..420a7d5 100644
--- a/modules/color-selector-cmyk.c
+++ b/modules/color-selector-cmyk.c
@@ -352,7 +352,7 @@ colorsel_cmyk_adj_update (GtkAdjustment *adj,
static cmsHPROFILE
color_config_get_rgb_profile (GimpColorConfig *config)
{
- cmsHPROFILE profile = NULL;
+ cmsHPROFILE profile = NULL;
if (config->rgb_profile)
profile = cmsOpenProfileFromFile (config->rgb_profile, "r");
@@ -360,6 +360,17 @@ color_config_get_rgb_profile (GimpColorConfig *config)
return profile ? profile : gimp_lcms_create_srgb_profile ();
}
+static cmsHPROFILE
+color_config_get_cmyk_profile (GimpColorConfig *config)
+{
+ cmsHPROFILE profile = NULL;
+
+ if (config->cmyk_profile)
+ profile = cmsOpenProfileFromFile (config->cmyk_profile, "r");
+
+ return profile;
+}
+
static void
colorsel_cmyk_config_changed (ColorselCmyk *module)
{
@@ -368,8 +379,8 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
cmsUInt32Number flags = 0;
cmsHPROFILE rgb_profile;
cmsHPROFILE cmyk_profile;
- gchar *descData = NULL;
- const gchar *name = NULL;
+ gchar *name;
+ gchar *summary;
gchar *text;
if (module->rgb2cmyk)
@@ -390,23 +401,25 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
if (! config)
goto out;
- if (! config->cmyk_profile ||
- ! (cmyk_profile = cmsOpenProfileFromFile (config->cmyk_profile, "r")))
+ rgb_profile = color_config_get_rgb_profile (config);
+ cmyk_profile = color_config_get_cmyk_profile (config);
+
+ if (! cmyk_profile)
goto out;
name = gimp_lcms_profile_get_description (cmyk_profile);
if (! name)
name = gimp_lcms_profile_get_model (cmyk_profile);
+ summary = gimp_lcms_profile_get_summary (cmyk_profile);
+
text = g_strdup_printf (_("Profile: %s"), name);
gtk_label_set_text (GTK_LABEL (module->name_label), text);
- gimp_help_set_help_data (module->name_label, text, NULL);
- g_free (text);
+ gimp_help_set_help_data (module->name_label, summary, NULL);
- if (descData)
- g_free (descData);
-
- rgb_profile = color_config_get_rgb_profile (config);
+ g_free (text);
+ g_free (name);
+ g_free (summary);
if (config->display_intent ==
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]