[gimp] plug-ins: don't create bogus combo entries in lcms_icc_combo_box_new()



commit 67391f6d9e45bbd88b9b75015c5ee2977d018967
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 30 01:34:34 2014 +0100

    plug-ins: don't create bogus combo entries in lcms_icc_combo_box_new()
    
    - verify that GimpColorConfig.rgb_profile actually is an RGB profile.
    - on failure, don't assoociate the rgb_profile filename with the
      built-in sRGB profile.

 plug-ins/common/lcms.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index 3475f8f..86d30f5 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -1278,7 +1278,8 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
   gchar       *history;
   gchar       *label;
   gchar       *name;
-  cmsHPROFILE  profile = NULL;
+  const gchar *rgb_filename = NULL;
+  cmsHPROFILE  profile      = NULL;
 
   dialog = gimp_color_profile_chooser_dialog_new (_("Select destination profile"));
   history = gimp_personal_rc_file ("profilerc");
@@ -1302,6 +1303,17 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
           g_message ("%s", error->message);
           g_clear_error (&error);
         }
+      else if (! gimp_lcms_profile_is_rgb (profile))
+        {
+          g_message (_("Color profile '%s' is not for RGB color space."),
+                     gimp_filename_to_utf8 (config->rgb_profile));
+          cmsCloseProfile (profile);
+          profile = NULL;
+        }
+      else
+        {
+          rgb_filename = config->rgb_profile;
+        }
     }
 
   if (! profile)
@@ -1317,7 +1329,7 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
   g_free (name);
 
   gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
-                                    config->rgb_profile, label);
+                                    rgb_filename, label);
   g_free (label);
 
   if (filename)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]