[gegl] buffer: gegl_buffer_constructor() was leaking references like crazy
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: gegl_buffer_constructor() was leaking references like crazy
- Date: Wed, 19 Sep 2012 23:15:33 +0000 (UTC)
commit 78724f82fffffabad6f4e6f0419afdc9aa9893e0
Author: Michael Natterer <mitch gimp org>
Date: Thu Sep 20 01:13:39 2012 +0200
buffer: gegl_buffer_constructor() was leaking references like crazy
No backend was ever unrefed after creating a storage with it.
gegl/buffer/gegl-buffer.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index 4d46019..3f70c90 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -562,25 +562,25 @@ gegl_buffer_constructor (GType type,
*/
if (buffer->backend)
{
- void *storage;
+ void *storage;
storage = gegl_tile_storage_new (buffer->backend);
source = g_object_new (GEGL_TYPE_BUFFER, "source", storage, NULL);
-
g_object_unref (storage);
gegl_tile_handler_set_source ((GeglTileHandler*)(buffer), source);
g_object_unref (source);
g_signal_connect (storage, "changed",
- G_CALLBACK(gegl_buffer_storage_changed), buffer);
+ G_CALLBACK (gegl_buffer_storage_changed),
+ buffer);
g_assert (source);
backend = gegl_buffer_backend (GEGL_BUFFER (source));
g_assert (backend);
- g_assert (backend == buffer->backend);
- }
+ g_assert (backend == buffer->backend);
+ }
else if (buffer->path && g_str_equal (buffer->path, "RAM"))
{
source = GEGL_TILE_SOURCE (gegl_buffer_new_from_format (buffer->format,
@@ -611,9 +611,12 @@ gegl_buffer_constructor (GType type,
"format", buffer->format?buffer->format:babl_format ("RGBA float"),
"path", buffer->path,
NULL);
+
storage = gegl_tile_storage_new (backend);
+ g_object_unref (backend);
source = g_object_new (GEGL_TYPE_BUFFER, "source", storage, NULL);
+ g_object_unref (storage);
/* after construction,. x and y should be set to reflect
* the top level behavior exhibited by this buffer object.
@@ -622,7 +625,8 @@ gegl_buffer_constructor (GType type,
g_object_unref (source);
g_signal_connect (storage, "changed",
- G_CALLBACK(gegl_buffer_storage_changed), buffer);
+ G_CALLBACK (gegl_buffer_storage_changed),
+ buffer);
g_assert (source);
backend = gegl_buffer_backend (GEGL_BUFFER (source));
@@ -1267,6 +1271,7 @@ gegl_tile_storage_new_cached (gint tile_width, gint tile_height,
"format", babl_fmt,
NULL);
storage = gegl_tile_storage_new (backend);
+ g_object_unref (backend);
}
else
{
@@ -1296,6 +1301,7 @@ gegl_tile_storage_new_cached (gint tile_width, gint tile_height,
"path", path,
NULL);
storage = gegl_tile_storage_new (backend);
+ g_object_unref (backend);
g_free (path);
}
item->storage = storage;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]