[gegl] Add gegl_buffer_cl_iterator_stop()



commit e74551d52614e2090990b70d6f486ff0d69c580f
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sat Oct 19 16:10:36 2013 -0700

    Add gegl_buffer_cl_iterator_stop()

 gegl/buffer/gegl-buffer-cl-iterator.c |   22 ++++++++++++++++------
 gegl/buffer/gegl-buffer-cl-iterator.h |    2 ++
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-cl-iterator.c b/gegl/buffer/gegl-buffer-cl-iterator.c
index 92c8943..29183d0 100644
--- a/gegl/buffer/gegl-buffer-cl-iterator.c
+++ b/gegl/buffer/gegl-buffer-cl-iterator.c
@@ -593,12 +593,25 @@ gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err)
       dealloc_iterator(i);
     }
 
-  *err = FALSE;
+  if (err)
+    *err = FALSE;
   return !i->is_finished;
 
 error:
+  gegl_buffer_cl_iterator_stop ((GeglBufferClIterator *)i);
 
-  for (no=0; no<i->iterators;no++)
+  if (err)
+    *err = TRUE;
+  return FALSE;
+}
+
+void
+gegl_buffer_cl_iterator_stop (GeglBufferClIterator *iterator)
+{
+  GeglBufferClIterators *i = (GeglBufferClIterators *)iterator;
+  int no;
+
+  for (no = 0; no < i->iterators; no++)
     {
       if (i->tex_buf[no]) gegl_clReleaseMemObject (i->tex_buf[no]);
       if (i->tex_op [no]) gegl_clReleaseMemObject (i->tex_op [no]);
@@ -608,10 +621,7 @@ error:
       i->tex_op [no] = NULL;
     }
 
-  dealloc_iterator(i);
-
-  *err = TRUE;
-  return FALSE;
+  dealloc_iterator (i);
 }
 
 GeglBufferClIterator *
diff --git a/gegl/buffer/gegl-buffer-cl-iterator.h b/gegl/buffer/gegl-buffer-cl-iterator.h
index 039d325..2129794 100644
--- a/gegl/buffer/gegl-buffer-cl-iterator.h
+++ b/gegl/buffer/gegl-buffer-cl-iterator.h
@@ -58,6 +58,8 @@ gint gegl_buffer_cl_iterator_add_2 (GeglBufferClIterator  *iterator,
 
 gboolean gegl_buffer_cl_iterator_next (GeglBufferClIterator *iterator, gboolean *err);
 
+void gegl_buffer_cl_iterator_stop (GeglBufferClIterator *iterator);
+
 GeglBufferClIterator *gegl_buffer_cl_iterator_new (GeglBuffer          *buffer,
                                                    const GeglRectangle *roi,
                                                    const Babl          *format,


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