diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-20 07:26:48 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-20 07:26:48 +0000 |
commit | c4cc4d31e618a97ec4d5655a8e543514c96bcecc (patch) | |
tree | 1a8cc5f59904d3d5e0f4977194c401941a214ffe /thread.c | |
parent | 43055ad26632abbfbc7ad1dbcac980ccf4feb7a6 (diff) | |
download | ruby-c4cc4d31e618a97ec4d5655a8e543514c96bcecc.tar.gz |
* thread.c (exec_recursive): prevent temporary objects from GC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -3701,10 +3701,14 @@ exec_recursive_i(VALUE tag, struct exec_recursive_params *p) static VALUE exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE arg, int outer) { + VALUE result = Qundef; struct exec_recursive_params p; int outermost; p.list = recursive_list_access(); p.objid = rb_obj_id(obj); + p.obj = obj; + p.pairid = pairid; + p.arg = arg; outermost = outer && !recursive_check(p.list, ID2SYM(recursive_key), 0); if (recursive_check(p.list, p.objid, pairid)) { @@ -3714,11 +3718,7 @@ exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE return (*func)(obj, arg, TRUE); } else { - VALUE result = Qundef; p.func = func; - p.obj = obj; - p.pairid = pairid; - p.arg = arg; if (outermost) { recursive_push(p.list, ID2SYM(recursive_key), 0); @@ -3731,8 +3731,9 @@ exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE else { result = exec_recursive_i(0, &p); } - return result; } + *(volatile struct exec_recursive_params *)&p; + return result; } /* |