gimp r24734 - in branches/gimp-2-4: . plug-ins/common



Author: neo
Date: Mon Jan 28 17:29:09 2008
New Revision: 24734
URL: http://svn.gnome.org/viewvc/gimp?rev=24734&view=rev

Log:
2008-01-28  Sven Neumann  <sven gimp org>

	Merged from trunk:

	* plug-ins/common/lcms.c (lcms_dialog): fixed crash on missing
	profile (bug #512529).
	(lcms_load_profile): fixed error messages.


Modified:
   branches/gimp-2-4/ChangeLog
   branches/gimp-2-4/plug-ins/common/lcms.c

Modified: branches/gimp-2-4/plug-ins/common/lcms.c
==============================================================================
--- branches/gimp-2-4/plug-ins/common/lcms.c	(original)
+++ branches/gimp-2-4/plug-ins/common/lcms.c	Mon Jan 28 17:29:09 2008
@@ -795,8 +795,7 @@
 
       if (! file)
         {
-          g_message (_("Could not open '%s' for reading: %s"),
-                     gimp_filename_to_utf8 (filename), error->message);
+          g_message (error->message);
           g_error_free (error);
 
           return FALSE;
@@ -1100,9 +1099,7 @@
 
   if (! file)
     {
-      g_message (_("Could not open '%s' for reading: %s"),
-                 gimp_filename_to_utf8 (filename),
-                 error->message);
+      g_message (error->message);
       g_error_free (error);
 
       return NULL;
@@ -1533,15 +1530,13 @@
                         &values->bpc);
     }
 
-  run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
-
-  gtk_widget_hide (dialog);
-
-  if (run)
+  while ((run = gimp_dialog_run (GIMP_DIALOG (dialog))) == GTK_RESPONSE_OK)
     {
       gchar       *filename = gimp_color_profile_combo_box_get_active (box);
       cmsHPROFILE  dest_profile;
 
+      gtk_widget_set_sensitive (dialog, FALSE);
+
       if (filename)
         {
           dest_profile = lcms_load_profile (filename, NULL);
@@ -1551,23 +1546,32 @@
           dest_profile = cmsCreate_sRGBProfile ();
         }
 
-      if (lcms_icc_profile_is_rgb (dest_profile))
+      if (dest_profile)
         {
-          if (apply)
-            success = lcms_image_apply_profile (image,
-                                                src_profile, dest_profile,
-                                                filename,
-                                                values->intent, values->bpc);
+          if (lcms_icc_profile_is_rgb (dest_profile))
+            {
+              if (apply)
+                success = lcms_image_apply_profile (image,
+                                                    src_profile, dest_profile,
+                                                    filename,
+                                                    values->intent,
+                                                    values->bpc);
+              else
+                success = lcms_image_set_profile (image,
+                                                  dest_profile, filename, TRUE);
+            }
           else
-            success = lcms_image_set_profile (image,
-                                              dest_profile, filename, TRUE);
-        }
-      else
-        {
-          gimp_message (_("Destination profile is not for RGB color space."));
+            {
+              gimp_message (_("Destination profile is not for RGB color space."));
+            }
+
+          cmsCloseProfile (dest_profile);
         }
 
-      cmsCloseProfile (dest_profile);
+      if (success)
+        break;
+      else
+        gtk_widget_set_sensitive (dialog, TRUE);
     }
 
   gtk_widget_destroy (dialog);



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