public
Last active

  • Download Gist
define_method_scope_bug.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
diff -rupN ruby-1.8.6-p287/eval.c ../ruby-1.8.6-p287/eval.c
--- ruby-1.8.6-p287/eval.c 2008-08-04 10:16:55.000000000
+++ ../ruby-1.8.6-p287/eval.c 2009-03-28 19:52:45.000000000
@@ -8629,6 +8629,7 @@ proc_invoke(proc, args, self, klass)
scope->local_tbl = _block.scope->local_tbl;
scope->local_vars = _block.scope->local_vars;
scope->flags |= SCOPE_CLONE;
+ scope->flags |= (_block.scope->flags & SCOPE_MALLOC);
_block.scope = scope;
}
/* modify current frame */
diff -rupN ruby-1.8.6-p287/gc.c ../ruby-1.8.6-p287/gc.c
--- ruby-1.8.6-p287/gc.c 2008-08-04 10:16:55.000000000
+++ ../ruby-1.8.6-p287/gc.c 2009-03-28 18:53:12.000000000
@@ -1270,7 +1270,7 @@ obj_free(obj)
VALUE *vars = RANY(obj)->as.scope.local_vars-1;
if (!(RANY(obj)->as.scope.flags & SCOPE_CLONE) && vars[0] == 0)
RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
- if (RANY(obj)->as.scope.flags & SCOPE_MALLOC)
+ if (RANY(obj)->as.scope.flags & SCOPE_MALLOC && !(RANY(obj)->as.scope.flags & SCOPE_CLONE))
RUBY_CRITICAL(free(vars));
}
break;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.