[gegl] GeglTileBackendRam: Free all buffers in finalize()



commit a8030a513acbdfe2465d390d23ef62f6e86efcff
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sun Jan 6 00:55:14 2013 -0800

    GeglTileBackendRam: Free all buffers in finalize()

 gegl/buffer/gegl-tile-backend-ram.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-backend-ram.c b/gegl/buffer/gegl-tile-backend-ram.c
index 308609a..69bb3b2 100644
--- a/gegl/buffer/gegl-tile-backend-ram.c
+++ b/gegl/buffer/gegl-tile-backend-ram.c
@@ -284,10 +284,22 @@ static void get_property (GObject    *object,
 }
 
 static void
+for_each_free (RamEntry           *key,
+               RamEntry           *entry,
+               GeglTileBackendRam *ram)
+{
+  gint tile_size = gegl_tile_backend_get_tile_size (GEGL_TILE_BACKEND (ram));
+  g_free (entry->offset);
+  dbg_dealloc (tile_size);
+  g_slice_free (RamEntry, entry);
+}
+
+static void
 finalize (GObject *object)
 {
-  GeglTileBackendRam *self = (GeglTileBackendRam *) object;
+  GeglTileBackendRam *self = GEGL_TILE_BACKEND (object);
 
+  g_hash_table_foreach (self->entries, (GHFunc)for_each_free, self);
   g_hash_table_unref (self->entries);
 
   (*G_OBJECT_CLASS (parent_class)->finalize)(object);



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