[gegl] operation_context: Don't reuse the empty buffer
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] operation_context: Don't reuse the empty buffer
- Date: Wed, 5 Jun 2013 04:14:20 +0000 (UTC)
commit a2db4e862cdae65b61d16c584a3ab35b57aed6ff
Author: Daniel Sabo <DanielSabo gmail com>
Date: Mon May 20 22:38:27 2013 -0700
operation_context: Don't reuse the empty buffer
Really this path should never be reached, but it's not safe
to reuse the buffer when we don't know what the op might
do to it.
gegl/operation/gegl-operation-context.c | 16 +---------------
1 files changed, 1 insertions(+), 15 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-context.c b/gegl/operation/gegl-operation-context.c
index 7a5ed4e..77bdb21 100644
--- a/gegl/operation/gegl-operation-context.c
+++ b/gegl/operation/gegl-operation-context.c
@@ -324,20 +324,6 @@ gegl_operation_context_get_source (GeglOperationContext *context,
return input;
}
-static GeglBuffer *emptybuf (void)
-{
- static GeglBuffer *empty = NULL; /* we leak this single empty buffer,
- avoiding having to create it weighs
- up the penalty.
- */
- if (!empty)
- {
- GeglRectangle rect={0,0,0,0};
- empty = gegl_buffer_new (&rect, babl_format ("RGBA float"));
- }
- return empty;
-}
-
GeglBuffer *
gegl_operation_context_get_target (GeglOperationContext *context,
const gchar *padname)
@@ -370,7 +356,7 @@ gegl_operation_context_get_target (GeglOperationContext *context,
if (result->width == 0 ||
result->height == 0)
{
- output = g_object_ref (emptybuf());
+ output = gegl_buffer_new_ram (GEGL_RECTANGLE (0, 0, 0, 0), format);
}
else if (node->dont_cache == FALSE &&
! GEGL_OPERATION_CLASS (G_OBJECT_GET_CLASS (operation))->no_cache)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]