[gimp] plug-ins: some cleanup in file-pat and file-gbr



commit 8ee9e5316357e48fd7654e734c445d7e0ed9e031
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 18 23:20:36 2012 +0100

    plug-ins: some cleanup in file-pat and file-gbr

 plug-ins/common/file-gbr.c |   13 +++++--------
 plug-ins/common/file-pat.c |   15 +++++++++------
 2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index be7c7b2..991aacb 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -178,12 +178,11 @@ run (const gchar      *name,
   GimpExportReturn   export = GIMP_EXPORT_CANCEL;
   GError            *error  = NULL;
 
-  run_mode = param[0].data.d_int32;
-
   INIT_I18N ();
-
   gegl_init (NULL, NULL);
 
+  run_mode = param[0].data.d_int32;
+
   *nreturn_vals = 1;
   *return_vals  = values;
 
@@ -622,10 +621,8 @@ load_image (GFile   *file,
   gegl_buffer_set (buffer, GEGL_RECTANGLE (0, 0, bh.width, bh.height), 0,
                    format, brush_buf, GEGL_AUTO_ROWSTRIDE);
 
-  g_object_unref (buffer);
-
   g_free (brush_buf);
-
+  g_object_unref (buffer);
   g_object_unref (input);
 
   gimp_progress_update (1.0);
@@ -762,11 +759,11 @@ save_image (GFile   *file,
     }
 
   g_free (brush_buf);
-
   g_object_unref (buffer);
-
   g_object_unref (output);
 
+  gimp_progress_update (1.0);
+
   return TRUE;
 }
 
diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c
index decdbb2..de2c62b 100644
--- a/plug-ins/common/file-pat.c
+++ b/plug-ins/common/file-pat.c
@@ -151,18 +151,17 @@ run (const gchar      *name,
   GimpExportReturn   export = GIMP_EXPORT_CANCEL;
   GError            *error  = NULL;
 
+  INIT_I18N ();
+  gegl_init (NULL, NULL);
+
   run_mode = param[0].data.d_int32;
 
   *nreturn_vals = 1;
   *return_vals  = values;
 
-  gegl_init (NULL, NULL);
-
   values[0].type          = GIMP_PDB_STATUS;
   values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
 
-  INIT_I18N ();
-
   if (strcmp (name, LOAD_PROC) == 0)
     {
       image_ID = load_image (g_file_new_for_uri (param[1].data.d_string),
@@ -463,12 +462,12 @@ load_image (GFile   *file,
       gimp_progress_update ((gdouble) line / (gdouble) ph.height);
     }
 
-  gimp_progress_update (1.0);
-
   g_free (buf);
   g_object_unref (buffer);
   g_object_unref (input);
 
+  gimp_progress_update (1.0);
+
   return image_ID;
 }
 
@@ -565,6 +564,7 @@ save_image (GFile   *file,
                                        &bytes_written, NULL, error) ||
           bytes_written != line_size)
         {
+          g_object_unref (buffer);
           g_object_unref (output);
           return FALSE;
         }
@@ -572,8 +572,11 @@ save_image (GFile   *file,
       gimp_progress_update ((gdouble) line / (gdouble) ph.height);
     }
 
+  g_object_unref (buffer);
   g_object_unref (output);
 
+  gimp_progress_update (1.0);
+
   return TRUE;
 }
 



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