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

ruby-changes:26451

From: usa <ko1@a...>
Date: Thu, 20 Dec 2012 18:36:44 +0900 (JST)
Subject: [ruby-changes:26451] usa:r38502 (ruby_1_9_3): merge revision(s) 38211: [Backport #7516]

usa	2012-12-20 18:36:33 +0900 (Thu, 20 Dec 2012)

  New Revision: 38502

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

  Log:
    merge revision(s) 38211: [Backport #7516]
    
    * ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
      @ptr should be updated. This fixes SEGV raised in DL::Function#call
      after calling DL::Function#bind. [Bug #7516] [ruby-dev:46708]
    
    * test/dl/test_func.rb (test_bind): test for the above

  Modified directories:
    branches/ruby_1_9_3/
    branches/ruby_1_9_3/test/dl/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/ext/dl/lib/dl/func.rb
    branches/ruby_1_9_3/test/dl/test_func.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 38501)
+++ ruby_1_9_3/ChangeLog	(revision 38502)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Thu Dec 20 18:36:19 2012  Naohisa Goto  <ngotogenome@g...>
+
+	* ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
+	  @ptr should be updated. This fixes SEGV raised in DL::Function#call
+	  after calling DL::Function#bind. [Bug #7516] [ruby-dev:46708]
+
+	* test/dl/test_func.rb (test_bind): test for the above
+
 Thu Dec 20 18:35:36 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* gc.h (SET_MACHINE_STACK_END): add volatile for preventing
Index: ruby_1_9_3/ext/dl/lib/dl/func.rb
===================================================================
--- ruby_1_9_3/ext/dl/lib/dl/func.rb	(revision 38501)
+++ ruby_1_9_3/ext/dl/lib/dl/func.rb	(revision 38502)
@@ -86,6 +86,8 @@ module DL https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/dl/lib/dl/func.rb#L86
             @block.call(*args)
           end
         }.new(@cfunc.ctype, @args, block)
+        @ptr = @cfunc
+        return nil
       else
         if( !block )
           raise(RuntimeError, "block must be given.")
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 38501)
+++ ruby_1_9_3/version.h	(revision 38502)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 348
+#define RUBY_PATCHLEVEL 349
 
 #define RUBY_RELEASE_DATE "2012-12-20"
 #define RUBY_RELEASE_YEAR 2012
Index: ruby_1_9_3/test/dl/test_func.rb
===================================================================
--- ruby_1_9_3/test/dl/test_func.rb	(revision 38501)
+++ ruby_1_9_3/test/dl/test_func.rb	(revision 38502)
@@ -9,6 +9,14 @@ module DL https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/dl/test_func.rb#L9
       assert_equal 'strcpy', f.name
     end
 
+    def test_bind
+      f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT])
+      assert_nothing_raised {
+        f.bind { |x, y| x + y }
+      }
+      assert_equal 579, f.call(123, 456)
+    end
+
     def test_to_i
       cfunc = CFunc.new(@libc['strcpy'], TYPE_VOIDP, 'strcpy')
       f = Function.new(cfunc, [TYPE_VOIDP, TYPE_VOIDP])

Property changes on: ruby_1_9_3/test/dl
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk/test/dl:r38211


Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r38211


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

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