[cairo-commit] rcairo/src rb_cairo.h, 1.13, 1.14 cairo.def, 1.10, 1.11 rb_cairo_surface.c, 1.24, 1.25

Kouhei Sutou commit at pdx.freedesktop.org
Thu Apr 10 18:35:40 PDT 2008


Committed by: kou

Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv3468/src

Modified Files:
	rb_cairo.h cairo.def rb_cairo_surface.c 
Log Message:
* src/cairo.def, src/rb_cairo.h, src/rb_cairo_surface.c: add
  CRSURFACE2RVAL_WITH_DESTROY() and
  rb_cairo_surface_to_ruby_object_with_destroy().

* src/rb_cairo_surface.c (cr_surface_create_similar): fix memory leak.


Index: rb_cairo.h
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- rb_cairo.h	29 Feb 2008 23:54:13 -0000	1.13
+++ rb_cairo.h	11 Apr 2008 01:40:25 -0000	1.14
@@ -165,6 +165,8 @@
 
 #define RVAL2CRSURFACE(obj)     (rb_cairo_surface_from_ruby_object(obj))
 #define CRSURFACE2RVAL(surface) (rb_cairo_surface_to_ruby_object(surface))
+#define CRSURFACE2RVAL_WITH_DESTROY(surface) \
+  (rb_cairo_surface_to_ruby_object_with_destroy(surface))
 
 cairo_t              *rb_cairo_context_from_ruby_object      (VALUE obj);
 VALUE                 rb_cairo_context_to_ruby_object        (cairo_t *cr);
@@ -198,6 +200,8 @@
 
 cairo_surface_t      *rb_cairo_surface_from_ruby_object      (VALUE obj);
 VALUE                 rb_cairo_surface_to_ruby_object        (cairo_surface_t *surface);
+VALUE                 rb_cairo_surface_to_ruby_object_with_destroy
+                                                             (cairo_surface_t *surface);
 
 
 #define RVAL2CROPERATOR(obj)      (rb_cairo_operator_from_ruby_object(obj))

Index: cairo.def
===================================================================
RCS file: /cvs/cairo/rcairo/src/cairo.def,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cairo.def	29 Feb 2008 23:54:13 -0000	1.10
+++ cairo.def	11 Apr 2008 01:40:26 -0000	1.11
@@ -74,6 +74,7 @@
     rb_cairo_glyph_to_ruby_object
     rb_cairo_surface_from_ruby_object
     rb_cairo_surface_to_ruby_object
+    rb_cairo_surface_to_ruby_object_with_destroy
     rb_cairo_operator_from_ruby_object
     rb_cairo_antialias_from_ruby_object
     rb_cairo_fill_rule_from_ruby_object

Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- rb_cairo_surface.c	25 Mar 2008 21:24:32 -0000	1.24
+++ rb_cairo_surface.c	11 Apr 2008 01:40:26 -0000	1.25
@@ -275,6 +275,16 @@
     }
 }
 
+VALUE
+rb_cairo_surface_to_ruby_object_with_destroy (cairo_surface_t *surface)
+{
+  VALUE rb_surface;
+  rb_surface = rb_cairo_surface_to_ruby_object (surface);
+  if (surface)
+    cairo_surface_destroy (surface);
+  return rb_surface;
+}
+
 static VALUE
 cr_surface_allocate (VALUE klass)
 {
@@ -311,7 +321,7 @@
                                           RVAL2CRCONTENT (content),
                                           NUM2INT (width), NUM2INT (height));
   cr_surface_check_status (surface);
-  return CRSURFACE2RVAL (surface);
+  return CRSURFACE2RVAL_WITH_DESTROY (surface);
 }
 
 static VALUE



More information about the cairo-commit mailing list