[前][次][番号順一覧][スレッド一覧]

ruby-changes:32916

From: normal <ko1@a...>
Date: Sun, 16 Feb 2014 13:19:34 +0900 (JST)
Subject: [ruby-changes:32916] normal:r44995 (trunk): io.c (rb_f_backquote): trade volatile for manual recycle

normal	2014-02-16 13:19:29 +0900 (Sun, 16 Feb 2014)

  New Revision: 44995

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44995

  Log:
    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

  Modified files:
    trunk/ChangeLog
    trunk/io.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44994)
+++ ChangeLog	(revision 44995)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Feb 16 12:46:47 2014  Eric Wong  <e@8...>
+
+	* 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@8...>
 
 	* marshal.c (marshal_dump): use rb_gc_force_recycle for GC-safety
Index: io.c
===================================================================
--- io.c	(revision 44994)
+++ io.c	(revision 44995)
@@ -8227,7 +8227,7 @@ argf_readlines(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/io.c#L8227
 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) https://github.com/ruby/ruby/blob/trunk/io.c#L8239
     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;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]