[gimp] app: don't leak all the image's GFiles



commit f5afc78532f6638a0f4bd5de4c9c686b232cb6a1
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jul 8 00:03:08 2014 +0200

    app: don't leak all the image's GFiles

 app/core/gimpimage-private.h |    8 ++++----
 app/core/gimpimage.c         |   24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index 35998a9..d5e5340 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -58,10 +58,10 @@ struct _GimpImagePrivate
 
   GimpMetadata      *metadata;              /*  image's metadata             */
 
-  GFile             *file;
-  GFile             *imported_file;
-  GFile             *exported_file;
-  GFile             *save_a_copy_file;
+  GFile             *file;                  /*  the image's XCF file         */
+  GFile             *imported_file;         /*  the image's source file      */
+  GFile             *exported_file;         /*  the image's export file      */
+  GFile             *save_a_copy_file;      /*  the image's save-a-copy file */
 
   gint               dirty;                 /*  dirty flag -- # of ops       */
   guint              dirty_time;            /*  time when image became dirty */
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index c1a83d5..474c915 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -969,6 +969,30 @@ gimp_image_finalize (GObject *object)
       private->metadata = NULL;
     }
 
+  if (private->file)
+    {
+      g_object_unref (private->file);
+      private->file = NULL;
+    }
+
+  if (private->imported_file)
+    {
+      g_object_unref (private->imported_file);
+      private->imported_file = NULL;
+    }
+
+  if (private->exported_file)
+    {
+      g_object_unref (private->exported_file);
+      private->exported_file = NULL;
+    }
+
+  if (private->save_a_copy_file)
+    {
+      g_object_unref (private->save_a_copy_file);
+      private->save_a_copy_file = NULL;
+    }
+
   if (private->layers)
     {
       g_object_unref (private->layers);


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