[gimp] app: revive debug utility function gimp_create_image_from_buffer()



commit 48ece1f31df65c0ec3449281459a408c9ceafa83
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 30 21:06:13 2014 +0200

    app: revive debug utility function gimp_create_image_from_buffer()
    
    and fix it not to leak the created image.

 app/core/gimp-utils.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index cb0ead9..fee79ac 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -937,7 +937,6 @@ void
 gimp_create_image_from_buffer (Gimp       *gimp,
                                GeglBuffer *buffer)
 {
-#if 0
   GimpImage  *image;
   GimpLayer  *layer;
   const Babl *format;
@@ -960,6 +959,8 @@ gimp_create_image_from_buffer (Gimp       *gimp,
                                       GIMP_NORMAL_MODE);
   gimp_image_add_layer (image, layer, NULL, -1, FALSE);
 
-  gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0);
-#endif
+  gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL, 0);
+
+  /* unref the image unconditionally, even when no display was created */
+  g_object_unref (image);
 }


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