Permalink
Browse files

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 3f084cd commit e85d6f8bf96adf655627d82888527e572e030f11 @unak unak committed Dec 20, 2012
Showing with 19 additions and 1 deletion.
  1. +8 −0 ChangeLog
  2. +2 −0 ext/dl/lib/dl/func.rb
  3. +8 −0 test/dl/test_func.rb
  4. +1 −1 version.h
View
@@ -1,3 +1,11 @@
+Thu Dec 20 18:36:19 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * 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@gmail.com>
* gc.h (SET_MACHINE_STACK_END): add volatile for preventing
View
@@ -86,6 +86,8 @@ def call *args
@block.call(*args)
end
}.new(@cfunc.ctype, @args, block)
+ @ptr = @cfunc
+ return nil
else
if( !block )
raise(RuntimeError, "block must be given.")
View
@@ -9,6 +9,14 @@ def test_name
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])
View
@@ -1,5 +1,5 @@
#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

0 comments on commit e85d6f8

Please sign in to comment.