gimp r24733 - in trunk: . plug-ins/common



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

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

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


Modified:
   trunk/ChangeLog
   trunk/plug-ins/common/lcms.c

Modified: trunk/plug-ins/common/lcms.c
==============================================================================
--- trunk/plug-ins/common/lcms.c	(original)
+++ trunk/plug-ins/common/lcms.c	Mon Jan 28 17:27:50 2008
@@ -1530,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);
@@ -1548,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]