[DRE-commits] r2922 - in packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian: . patches

terceiro-guest at alioth.debian.org terceiro-guest at alioth.debian.org
Sun Aug 3 23:27:28 UTC 2008


Author: terceiro-guest
Date: 2008-08-03 23:27:27 +0000 (Sun, 03 Aug 2008)
New Revision: 2922

Added:
   packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/patches/10-fixes-object-allocation-in-gc-phase.diff
Modified:
   packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/changelog
   packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/control
Log:
fixing #487204 by backporting change from CVS upstream



Modified: packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/changelog
===================================================================
--- packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/changelog	2008-08-03 23:09:08 UTC (rev 2921)
+++ packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/changelog	2008-08-03 23:27:27 UTC (rev 2922)
@@ -1,3 +1,10 @@
+libcairo-ruby (1.5.1-2) unstable; urgency=low
+
+  * Backported change from CVS (r1.32-> r1.33, src/rb_cairo_surface.rb) to fix
+    object allocation during garbage collection phase. (Closes: #487204).
+
+ -- Antonio Terceiro <terceiro at softwarelivre.org>  Sun, 03 Aug 2008 20:10:38 -0300
+
 libcairo-ruby (1.5.1-1) unstable; urgency=low
 
   [ Arnaud Cornet ]

Modified: packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/control
===================================================================
--- packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/control	2008-08-03 23:09:08 UTC (rev 2921)
+++ packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/control	2008-08-03 23:27:27 UTC (rev 2922)
@@ -2,7 +2,7 @@
 Section: libs
 Priority: optional
 Maintainer: Paul van Tilburg <paulvt at debian.org>
-Uploaders: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
+Uploaders: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>, Antonio Terceiro <terceiro at softwarelivre.org>
 Build-Depends: debhelper (>> 5), ruby, ruby1.8, ruby1.8-dev, ruby1.9, ruby1.9-dev, cdbs, ruby-pkg-tools (>= 0.8), libcairo2-dev (>= 1.2.0)
 Standards-Version: 3.7.3
 Homepage: http://cairographics.org/rcairo

Added: packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/patches/10-fixes-object-allocation-in-gc-phase.diff
===================================================================
--- packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/patches/10-fixes-object-allocation-in-gc-phase.diff	                        (rev 0)
+++ packages/libcairo-ruby/branches/1.5.1-1+bug487204/debian/patches/10-fixes-object-allocation-in-gc-phase.diff	2008-08-03 23:27:27 UTC (rev 2922)
@@ -0,0 +1,166 @@
+diff -ru libcairo-ruby-1.5.1-from-archive/src/rb_cairo_surface.c libcairo-ruby-1.5.1/src/rb_cairo_surface.c
+--- libcairo-ruby-1.5.1-from-archive/src/rb_cairo_surface.c	2008-08-03 19:31:19.000000000 -0300
++++ libcairo-ruby-1.5.1/src/rb_cairo_surface.c	2008-08-03 19:40:44.000000000 -0300
+@@ -35,7 +35,9 @@
+ static ID cr_id_target;
+ static ID cr_id_read;
+ static ID cr_id_write;
++static ID cr_id_instances;
+ static cairo_user_data_key_t cr_closure_key;
++static cairo_user_data_key_t cr_object_holder_key;
+ 
+ #define _SELF  (RVAL2CRSURFACE(self))
+ 
+@@ -101,7 +103,7 @@
+ static void
+ cr_closure_destroy (cr_io_callback_closure_t *closure)
+ {
+-  free (closure);
++  xfree (closure);
+ }
+ 
+ static void
+@@ -224,12 +226,52 @@
+ }
+ 
+ static void
++add_gc_guard (VALUE self)
++{
++  rb_hash_aset (rb_ivar_get (rb_cCairo_Surface, cr_id_instances),
++                self, Qnil);
++}
++
++static void
++remove_gc_guard (VALUE self)
++{
++  rb_hash_delete (rb_ivar_get (rb_cCairo_Surface, cr_id_instances),
++                  self);
++}
++
++typedef struct cr_object_holder {
++  VALUE object;
++} cr_object_holder_t;
++
++static cr_object_holder_t *
++cr_object_holder_new (VALUE object)
++{
++  cr_object_holder_t *holder;
++
++  holder = ALLOC(cr_object_holder_t);
++  add_gc_guard (object);
++  holder->object = object;
++  return holder;
++}
++
++static void
++cr_object_holder_free (void *ptr)
++{
++  cr_object_holder_t *holder = ptr;
++
++  if (!NIL_P (holder->object))
++    remove_gc_guard (holder->object);
++
++  xfree (holder);
++}
++
++static void
+ cr_surface_free (void *ptr)
+ {
+-  if (ptr)
+-    {
+-      cairo_surface_destroy ((cairo_surface_t *) ptr);
+-    }
++  cairo_surface_t *surface = ptr;
++
++  if (surface)
++    cairo_surface_destroy (surface);
+ }
+ 
+ VALUE
+@@ -255,23 +297,30 @@
+ }
+ 
+ /* Surface manipulation */
+-static void
+-yield_and_finish (VALUE self)
++static VALUE
++cr_surface_finish (VALUE self)
+ {
+   cairo_surface_t *surface;
+-  cairo_status_t status;
+-
+-  rb_yield (self);
++  cr_io_callback_closure_t *closure;
+ 
+   surface = _SELF;
+-  if (cairo_surface_status (surface))
+-    return;
++  closure = cairo_surface_get_user_data (surface, &cr_closure_key);
++
+   cairo_surface_finish (surface);
+-  status = cairo_surface_status (surface);
+-  if (status == CAIRO_STATUS_SUCCESS || status == CAIRO_STATUS_SURFACE_FINISHED)
+-    return;
++  cairo_surface_set_user_data (surface, &cr_object_holder_key, NULL, NULL);
+ 
++  if (closure && !NIL_P (closure->error))
++    rb_exc_raise (closure->error);
+   cr_surface_check_status (surface);
++
++  return self;
++}
++
++static void
++yield_and_finish (VALUE self)
++{
++  rb_yield (self);
++  cr_surface_finish (self);
+ }
+ 
+ static VALUE
+@@ -288,21 +337,6 @@
+ }
+ 
+ static VALUE
+-cr_surface_finish (VALUE self)
+-{
+-  cr_io_callback_closure_t *closure;
+-  closure = cairo_surface_get_user_data (_SELF, &cr_closure_key);
+-  
+-  cairo_surface_finish (_SELF);
+-
+-  if (closure && !NIL_P (closure->error))
+-    rb_exc_raise (closure->error);
+-  
+-  cr_surface_check_status (_SELF);
+-  return self;
+-}
+-
+-static VALUE
+ cr_surface_get_content (VALUE self)
+ {
+   return INT2NUM (cairo_surface_get_content (_SELF));
+@@ -601,6 +635,9 @@
+           rb_ivar_set (self, cr_id_target, target);                     \
+           cairo_surface_set_user_data (surface, &cr_closure_key,        \
+                                        closure, cr_closure_free);       \
++          cairo_surface_set_user_data (surface, &cr_object_holder_key,  \
++                                       cr_object_holder_new(self),      \
++                                       cr_object_holder_free);          \
+         }                                                               \
+     }                                                                   \
+   else                                                                  \
+@@ -907,10 +944,13 @@
+   cr_id_target = rb_intern ("target");
+   cr_id_read = rb_intern ("read");
+   cr_id_write = rb_intern ("write");
++  cr_id_instances = rb_intern ("instances");
+   
+   rb_cCairo_Surface =
+     rb_define_class_under (rb_mCairo, "Surface", rb_cObject);
+   rb_define_alloc_func (rb_cCairo_Surface, cr_surface_allocate);
++
++  rb_ivar_set (rb_cCairo_Surface, cr_id_instances, rb_hash_new ());
+   
+   rb_define_method (rb_cCairo_Surface, "create_similar",
+                     cr_surface_create_similar, 3);




More information about the Pkg-ruby-extras-commits mailing list