[cairo-commit] rcairo/src rb_cairo_surface.c,1.34,1.35
Kouhei Sutou
commit at pdx.freedesktop.org
Thu Jun 19 18:56:49 PDT 2008
Committed by: kou
Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv823/src
Modified Files:
rb_cairo_surface.c
Log Message:
* src/rb_cairo_surface.c: finish all guarded surfaces at end.
Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- rb_cairo_surface.c 19 Jun 2008 13:00:19 -0000 1.34
+++ rb_cairo_surface.c 20 Jun 2008 01:56:47 -0000 1.35
@@ -15,6 +15,8 @@
#include "rb_cairo.h"
#include "rb_cairo_private.h"
+#include <st.h>
+
#ifdef CAIRO_HAS_WIN32_SURFACE
# define OpenFile OpenFile_win32
# include <cairo-win32.h>
@@ -61,6 +63,7 @@
static ID cr_id_size;
static ID cr_id_set_unit;
static ID cr_id_instances;
+static ID cr_id_dup;
static cairo_user_data_key_t cr_closure_key;
static cairo_user_data_key_t cr_object_holder_key;
@@ -1141,6 +1144,21 @@
# endif
#endif
+static int
+cr_finish_all_guarded_surfaces_at_end_iter (VALUE key, VALUE value, VALUE data)
+{
+ cr_surface_finish (key);
+ return ST_CONTINUE;
+}
+
+static void
+cr_finish_all_guarded_surfaces_at_end (VALUE data)
+{
+ rb_hash_foreach (rb_funcall (rb_ivar_get (rb_cCairo_Surface, cr_id_instances),
+ cr_id_dup, 0),
+ cr_finish_all_guarded_surfaces_at_end_iter,
+ Qnil);
+}
void
Init_cairo_surface (void)
@@ -1153,6 +1171,9 @@
cr_id_size = rb_intern ("size");
cr_id_set_unit = rb_intern ("unit=");
cr_id_instances = rb_intern ("instances");
+ cr_id_dup = rb_intern ("dup");
+
+ rb_set_end_proc(cr_finish_all_guarded_surfaces_at_end, Qnil);
rb_cCairo_Surface =
rb_define_class_under (rb_mCairo, "Surface", rb_cObject);
More information about the cairo-commit
mailing list