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

ruby-changes:16199

From: akr <ko1@a...>
Date: Sat, 5 Jun 2010 11:01:52 +0900 (JST)
Subject: [ruby-changes:16199] Ruby:r28163 (trunk, ruby_1_9_2): * error.c (rb_name_err_mesg_new): guard mesg, recv and method.

akr	2010-06-05 11:01:29 +0900 (Sat, 05 Jun 2010)

  New Revision: 28163

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

  Log:
    * error.c (rb_name_err_mesg_new): guard mesg, recv and method.
      The problem in [ruby-dev:41464] is caused because mesg is collected.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/error.c
    trunk/ChangeLog
    trunk/error.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28162)
+++ ChangeLog	(revision 28163)
@@ -1,3 +1,8 @@
+Sat Jun  5 11:00:48 2010  Tanaka Akira  <akr@f...>
+
+	* error.c (rb_name_err_mesg_new): guard mesg, recv and method.
+	  The problem in [ruby-dev:41464] is caused because mesg is collected.
+
 Sat Jun  5 10:03:31 2010  Tanaka Akira  <akr@f...>
 
 	* .gdbinit (rp): detect and show RTypedData.
Index: error.c
===================================================================
--- error.c	(revision 28162)
+++ error.c	(revision 28163)
@@ -825,11 +825,16 @@
 rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
 {
     VALUE *ptr = ALLOC_N(VALUE, NAME_ERR_MESG_COUNT);
+    VALUE result;
 
     ptr[0] = mesg;
     ptr[1] = recv;
     ptr[2] = method;
-    return TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
+    result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
+    RB_GC_GUARD(mesg);
+    RB_GC_GUARD(recv);
+    RB_GC_GUARD(method);
+    return result;
 }
 
 /* :nodoc: */
Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28162)
+++ ruby_1_9_2/ChangeLog	(revision 28163)
@@ -1,3 +1,8 @@
+Sat Jun  5 11:00:48 2010  Tanaka Akira  <akr@f...>
+
+	* error.c (rb_name_err_mesg_new): guard mesg, recv and method.
+	  The problem in [ruby-dev:41464] is caused because mesg is collected.
+
 Sat Jun  5 09:56:57 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby.c (process_options): revert r25330, so that $0 can be seen
Index: ruby_1_9_2/error.c
===================================================================
--- ruby_1_9_2/error.c	(revision 28162)
+++ ruby_1_9_2/error.c	(revision 28163)
@@ -825,11 +825,16 @@
 rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
 {
     VALUE *ptr = ALLOC_N(VALUE, NAME_ERR_MESG_COUNT);
+    VALUE result;
 
     ptr[0] = mesg;
     ptr[1] = recv;
     ptr[2] = method;
-    return TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
+    result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
+    RB_GC_GUARD(mesg);
+    RB_GC_GUARD(recv);
+    RB_GC_GUARD(method);
+    return result;
 }
 
 /* :nodoc: */

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

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