[gegl] gegl-tile: fix tile destruction when data == NULL



commit 10c584c31303ca6b1a2be37b70cebc73cbe4d427
Author: Ell <ell_se yahoo com>
Date:   Fri Jul 21 07:15:42 2017 -0400

    gegl-tile: fix tile destruction when data == NULL
    
    Argh!

 gegl/buffer/gegl-tile.c |   51 ++++++++++++++++++++--------------------------
 1 files changed, 22 insertions(+), 29 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 037f03b..bac5520 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -62,37 +62,30 @@ void gegl_tile_unref (GeglTile *tile)
    */
   gegl_tile_store (tile);
 
-  if (tile->data)
-    {
-      if (g_atomic_int_dec_and_test (tile->n_clones))
-        { /* no clones */
-          if (tile->destroy_notify)
-            {
-              if (tile->destroy_notify == (void*)&free_n_clones_directly)
-                {
-                  /* tile->n_clones and tile->data share the same buffer,
-                   * with tile->n_clones at the front, so free the buffer
-                   * through it.
-                   */
-                  gegl_free (tile->n_clones);
-                }
-              else
-                {
-                  /* tile->n_clones and tile->data are unrelated, so free them
-                   * separately.
-                   */
-                  if (tile->destroy_notify == (void*)&free_data_directly)
-                    gegl_free (tile->data);
-                  else
-                    tile->destroy_notify (tile->destroy_notify_data);
-
-                  g_slice_free (gint, tile->n_clones);
-                }
-            }
-          else
+  if (g_atomic_int_dec_and_test (tile->n_clones))
+    { /* no clones */
+      if (tile->destroy_notify == (void*)&free_n_clones_directly)
+        {
+          /* tile->n_clones and tile->data share the same buffer,
+           * with tile->n_clones at the front, so free the buffer
+           * through it.
+           */
+          gegl_free (tile->n_clones);
+        }
+      else
+        {
+          /* tile->n_clones and tile->data are unrelated, so free them
+           * separately.
+           */
+          if (tile->data)
             {
-              g_slice_free (gint, tile->n_clones);
+              if (tile->destroy_notify == (void*)&free_data_directly)
+                gegl_free (tile->data);
+              else if (tile->destroy_notify)
+                tile->destroy_notify (tile->destroy_notify_data);
             }
+
+          g_slice_free (gint, tile->n_clones);
         }
     }
 


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