[DRE-maint] Bug#494515: libgnome2-ruby1.8: "object allocation during garbage collection phase" fixed in upstream svn
Peter De Wachter
pdewacht at gmail.com
Wed Aug 20 20:28:58 UTC 2008
Tags: patch
Followup-For: Bug #494515
I found two revision in the upstream SVN that deal with garbage
collection (revisions 3255 and 3263). When I applied these changes to
the Debian package, the script runs without crashing.
(The script doesn't animate properly though, it should use a
GtkDrawingArea. Fixed version attached :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ruby-gnome2-svn3255.patch
Type: text/x-c
Size: 5078 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20080820/c4d1a05e/attachment.bin
-------------- next part --------------
--- a/glib/ChangeLog
+++ b/glib/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-27 Sjoerd Simons <sjoerd at luon.net>
+
+ * src/rbgobj_closure.c: Only use G_REMOVE_RELATIVE when a closure is
+ directly invalidated. This prevents object creation when freeing the
+ closure from the garbage collector.
+
2008-06-19 Kouhei Sutou <kou at cozmixng.org>
* src/rbgobj_type.c (rbgobj_lookup_class_by_gtype_body): add
--- a/glib/src/rbgobj_closure.c
+++ b/glib/src/rbgobj_closure.c
@@ -142,9 +142,6 @@
GList *next;
for (next = rclosure->objects; next; next = next->next) {
GObject *object = G_OBJECT(next->data);
- VALUE obj = rbgobj_ruby_object_from_instance2(object, FALSE);
- if (!NIL_P(rclosure->rb_holder) && !NIL_P(obj))
- G_REMOVE_RELATIVE(obj, id_closures, rclosure->rb_holder);
g_object_weak_unref(object, rclosure_weak_notify, rclosure);
}
g_list_free(rclosure->objects);
@@ -163,7 +160,16 @@
GRClosure *rclosure = (GRClosure*)closure;
if (rclosure->count > 0) {
+ GList *next;
+
rclosure->count = 1;
+ for (next = rclosure->objects; next; next = next->next) {
+ GObject *object = G_OBJECT(next->data);
+ VALUE obj = rbgobj_ruby_object_from_instance2(object, FALSE);
+ if (!NIL_P(rclosure->rb_holder) && !NIL_P(obj))
+ G_REMOVE_RELATIVE(obj, id_closures, rclosure->rb_holder);
+ }
+
rclosure_unref(rclosure);
}
}
@@ -178,7 +184,13 @@
static void
gr_closure_holder_free(GRClosure *rclosure)
{
- rclosure_invalidate(NULL, (GClosure*)rclosure);
+ if (rclosure->count > 0) {
+ rclosure->count = 1;
+
+ /* No need to remove us from the relatives hash of our objects, as
+ * those aren't alive anymore anyway */
+ rclosure_unref(rclosure);
+ }
}
GClosure*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: animation.rb
Type: text/x-pascal
Size: 2174 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20080820/c4d1a05e/attachment.pas
More information about the Pkg-ruby-extras-maintainers
mailing list