1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

io.c (rb_f_backquote): trade volatile for manual recycle

* io.c (rb_f_backquote): trade volatile for manual recycle
  rb_gc_force_recycle ensures object is visible until recycle

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2014-02-16 04:19:29 +00:00
parent f97051512a
commit 10a8e87ce5
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sun Feb 16 12:46:47 2014 Eric Wong <e@80x24.org>
* io.c (rb_f_backquote): trade volatile for manual recycle
rb_gc_force_recycle ensures object is visible until recycle
Sun Feb 16 11:55:14 2014 Eric Wong <e@80x24.org>
* marshal.c (marshal_dump): use rb_gc_force_recycle for GC-safety

4
io.c
View file

@ -8227,7 +8227,7 @@ argf_readlines(int argc, VALUE *argv, VALUE argf)
static VALUE
rb_f_backquote(VALUE obj, VALUE str)
{
volatile VALUE port;
VALUE port;
VALUE result;
rb_io_t *fptr;
@ -8239,6 +8239,8 @@ rb_f_backquote(VALUE obj, VALUE str)
GetOpenFile(port, fptr);
result = read_all(fptr, remain_size(fptr), Qnil);
rb_io_close(port);
rb_io_fptr_finalize(fptr);
rb_gc_force_recycle(port); /* also guards from premature GC */
return result;
}