ruby-changes:21078
From: nagachika <ko1@a...>
Date: Tue, 30 Aug 2011 22:39:40 +0900 (JST)
Subject: [ruby-changes:21078] nagachika:r33127 (trunk): * test/dl/test_callback.rb (test_callback_with_string): prevents
nagachika 2011-08-30 22:39:31 +0900 (Tue, 30 Aug 2011) New Revision: 33127 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33127 Log: * test/dl/test_callback.rb (test_callback_with_string): prevents temporary string from GC. Modified files: trunk/ChangeLog trunk/test/dl/test_callback.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 33126) +++ ChangeLog (revision 33127) @@ -1,3 +1,8 @@ +Tue Aug 30 22:34:45 2011 CHIKANAGA Tomoyuki <nagachika00@g...> + + * test/dl/test_callback.rb (test_callback_with_string): prevents + temporary string from GC. + Tue Aug 30 22:25:38 2011 NAKAMURA Usaku <usa@r...> * vm_insnhelper.c (vm_call_cfunc): revert r33112. RB_GC_GUARD macro Index: test/dl/test_callback.rb =================================================================== --- test/dl/test_callback.rb (revision 33126) +++ test/dl/test_callback.rb (revision 33127) @@ -48,8 +48,11 @@ func = CFunc.new(addr, TYPE_VOID, 'test') f = Function.new(func, [TYPE_VOIDP]) - f.call(dlwrap('foo')) - assert_equal 'foo', called_with + # Don't remove local variable arg. + # This necessary to protect objects from GC. + arg = 'foo' + f.call(dlwrap(arg)) + assert_equal arg, called_with end def test_call_callback -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/