[gimp] Issue #1953 - Crashes during color profile conversion



commit 753523c4d137774e99f94603b8e2f4ba414ddf3a
Author: Michael Natterer <mitch gimp org>
Date:   Thu Aug 9 18:53:13 2018 +0200

    Issue #1953 - Crashes during color profile conversion
    
    gimp_image_convert_color_profile(): need to ref the src_profile across
    the conversion because gimp_image_set_color_profile() might unref it.

 app/core/gimpimage-color-profile.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpimage-color-profile.c b/app/core/gimpimage-color-profile.c
index 5337b5bc1b..1929c9b813 100644
--- a/app/core/gimpimage-color-profile.c
+++ b/app/core/gimpimage-color-profile.c
@@ -442,7 +442,7 @@ gimp_image_convert_color_profile (GimpImage                *image,
 
   src_profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
 
-  if (! src_profile || gimp_color_profile_is_equal (src_profile, dest_profile))
+  if (gimp_color_profile_is_equal (src_profile, dest_profile))
     return TRUE;
 
   if (progress)
@@ -454,6 +454,9 @@ gimp_image_convert_color_profile (GimpImage                *image,
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_CONVERT,
                                _("Color profile conversion"));
 
+  /* retain src_profile across gimp_image_set_color_profile() */
+  g_object_ref (src_profile);
+
   gimp_image_set_is_color_managed (image, TRUE, TRUE);
   gimp_image_set_color_profile (image, dest_profile, NULL);
   /*  omg...  */
@@ -478,6 +481,8 @@ gimp_image_convert_color_profile (GimpImage                *image,
       break;
     }
 
+  g_object_unref (src_profile);
+
   gimp_image_undo_group_end (image);
 
   if (progress)


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