From 7e1d69f231ca1de06ee629b0d24d56258067d2e3 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 21 Apr 2003 08:17:18 +0000 Subject: [PATCH] * gc.c (rb_gc): use rb_gc_mark_maybe() to mark registered C addresses. C variables may not hold valid reference to Ruby objects. [ruby-core:00975] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ gc.c | 2 +- lib/singleton.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e9e80831a..fc5bf28fd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,12 @@ Sat Apr 19 21:55:10 2003 Akinori MUSHA * ext/Setup*: Add zlib and remove bogus and obsolete entries. +Sat Apr 19 14:47:07 2003 Yukihiro Matsumoto + + * gc.c (rb_gc): use rb_gc_mark_maybe() to mark registered C + addresses. C variables may not hold valid reference to Ruby + objects. [ruby-core:00975] + Sat Apr 19 00:56:13 2003 Yukihiro Matsumoto * struct.c (rb_struct_eql): should compare values with "eql?". diff --git a/gc.c b/gc.c index ae7cff920d..9097225184 100644 --- a/gc.c +++ b/gc.c @@ -1236,7 +1236,7 @@ rb_gc() /* mark protected global variables */ for (list = global_List; list; list = list->next) { - rb_gc_mark(*list->varptr); + rb_gc_mark_maybe(*list->varptr); } rb_mark_end_proc(); rb_gc_mark_global_tbl(); diff --git a/lib/singleton.rb b/lib/singleton.rb index 3c20c13253..147b04187c 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -156,7 +156,7 @@ module Singleton @__instance__ = new ensure if @__instance__ - def self.instance() @__instance__ end + define_method(:instance) {@__instance__} else @__instance__ = nil end