[gimp] app: don't leak the input stream when loading a viewable's icon pixbuf



commit 872b1f3221751f72f0f606b9697e5a8d42107095
Author: Michael Natterer <mitch gimp org>
Date:   Sat Mar 9 21:12:00 2013 +0100

    app: don't leak the input stream when loading a viewable's icon pixbuf

 app/core/gimpviewable.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpviewable.c b/app/core/gimpviewable.c
index 883bde2..6eb9940 100644
--- a/app/core/gimpviewable.c
+++ b/app/core/gimpviewable.c
@@ -117,7 +117,6 @@ static gboolean gimp_viewable_serialize_property     (GimpConfig    *config,
                                                       const GValue  *value,
                                                       GParamSpec    *pspec,
                                                       GimpConfigWriter *writer);
-
 static gboolean gimp_viewable_deserialize_property   (GimpConfig       *config,
                                                       guint             property_id,
                                                       GValue           *value,
@@ -125,6 +124,7 @@ static gboolean gimp_viewable_deserialize_property   (GimpConfig       *config,
                                                       GScanner         *scanner,
                                                       GTokenType       *expected);
 
+
 G_DEFINE_TYPE_WITH_CODE (GimpViewable, gimp_viewable, GIMP_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
                                                 gimp_viewable_config_iface_init))
@@ -210,7 +210,7 @@ static void
 gimp_viewable_config_iface_init (GimpConfigInterface *iface)
 {
   iface->deserialize_property = gimp_viewable_deserialize_property;
-  iface->serialize_property = gimp_viewable_serialize_property;
+  iface->serialize_property   = gimp_viewable_serialize_property;
 }
 
 static void
@@ -522,17 +522,20 @@ gimp_viewable_deserialize_property (GimpConfig *config,
                 pixbuf = gdk_pixbuf_new_from_stream (decoded_image_stream,
                                                      NULL,
                                                      NULL);
+                g_object_unref (decoded_image_stream);
+
                 if (pixbuf)
                   {
                     if (icon_pixbuf)
                       g_object_unref (icon_pixbuf);
                     icon_pixbuf = pixbuf;
                   }
+
                 g_free (decoded_image);
               }
           }
 
-          g_value_take_object (value, icon_pixbuf);
+        g_value_take_object (value, icon_pixbuf);
       }
       break;
 


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