ruby-changes:39408
From: nobu <ko1@a...>
Date: Wed, 5 Aug 2015 14:40:37 +0900 (JST)
Subject: [ruby-changes:39408] nobu:r51489 (trunk): transcode.c: GC guards
nobu 2015-08-05 14:40:17 +0900 (Wed, 05 Aug 2015) New Revision: 51489 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51489 Log: transcode.c: GC guards * transcode.c (econv_init): add guards to prevent source encoding name and destination encoding name from GC. Modified files: trunk/transcode.c Index: transcode.c =================================================================== --- transcode.c (revision 51488) +++ transcode.c (revision 51489) @@ -3391,7 +3391,10 @@ econv_init(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/transcode.c#L3391 } if (!ec) { - rb_exc_raise(rb_econv_open_exc(sname, dname, ecflags)); + VALUE exc = rb_econv_open_exc(sname, dname, ecflags); + RB_GC_GUARD(snamev); + RB_GC_GUARD(dnamev); + rb_exc_raise(exc); } if (!DECORATOR_P(sname, dname)) { @@ -3399,6 +3402,8 @@ econv_init(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/transcode.c#L3402 senc = make_dummy_encoding(sname); if (!denc) denc = make_dummy_encoding(dname); + RB_GC_GUARD(snamev); + RB_GC_GUARD(dnamev); } ec->source_encoding = senc; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/