diff --git a/ChangeLog b/ChangeLog index c25f72594c..a38f86ed3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri May 2 23:55:15 2008 Tanaka Akira + + * variable.c (rb_define_hooked_variable): guard *var from GC to + prevent collecting argf under RUBY_DEBUG=gc_stress. + Fri May 2 17:29:59 2008 Yukihiro Matsumoto * range.c (range_step): call to_int if step is not a numeric diff --git a/variable.c b/variable.c index 154f0872b0..a935c51d3a 100644 --- a/variable.c +++ b/variable.c @@ -455,13 +455,20 @@ rb_define_hooked_variable( void (*setter)(ANYARGS)) { struct global_variable *gvar; - ID id = global_id(name); + ID id; + VALUE tmp; + + if (var) + tmp = *var; + id = global_id(name); gvar = rb_global_entry(id)->var; gvar->data = (void*)var; gvar->getter = getter?getter:var_getter; gvar->setter = setter?setter:var_setter; gvar->marker = var_marker; + + RB_GC_GUARD(tmp); } void