[macruby-changes] [3608] MacRuby/branches/icu/ruby.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 24 15:58:26 PST 2010


Revision: 3608
          http://trac.macosforge.org/projects/ruby/changeset/3608
Author:   lsansonetti at apple.com
Date:     2010-02-24 15:58:23 -0800 (Wed, 24 Feb 2010)
Log Message:
-----------
always retain rb_progname

Modified Paths:
--------------
    MacRuby/branches/icu/ruby.c

Modified: MacRuby/branches/icu/ruby.c
===================================================================
--- MacRuby/branches/icu/ruby.c	2010-02-24 23:05:40 UTC (rev 3607)
+++ MacRuby/branches/icu/ruby.c	2010-02-24 23:58:23 UTC (rev 3608)
@@ -832,7 +832,7 @@
     return enc;
 }
 
-VALUE rb_progname;
+VALUE rb_progname = Qnil;
 VALUE rb_argv0;
 
 static rb_encoding *src_encoding;
@@ -1276,14 +1276,18 @@
 	}
     }
 #endif
+    GC_RELEASE(rb_progname);
     rb_progname = rb_tainted_str_new(s, i);
+    GC_RETAIN(rb_progname);
 }
 
 void
 ruby_script(const char *name)
 {
-    if (name) {
+    if (name != NULL) {
+	GC_RELEASE(rb_progname);
 	rb_progname = rb_tainted_str_new2(name);
+	GC_RETAIN(rb_progname);
     }
 }
 
@@ -1350,7 +1354,6 @@
 
     rb_define_hooked_variable("$0", &rb_progname, 0, set_arg0);
     rb_define_hooked_variable("$PROGRAM_NAME", &rb_progname, 0, set_arg0);
-    GC_ROOT(&rb_progname);
 
     rb_define_global_const("ARGV", rb_argv);
     rb_global_variable(&rb_argv0);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100224/4df32727/attachment-0001.html>


More information about the macruby-changes mailing list