[Bug #1477] DL::Function#unbind raises TypeError


#1

Bug #1477: DL::Function#unbind raises TypeError
http://redmine.ruby-lang.org/issues/show/1477

e$B5/I<<Te(B: Takashi T.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: ext, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-05-16 trunk 23440) [i686-linux]

e$B%3!<%k%P%C%/$G$O$J$$C1$J$ke(B DL::Function e$B$KBP$7$Fe(B unbind
e$B$r8F$V$He(B
e$B$h$/$o$+$i$J$$%(%i!<$,=P$^$9!#e(B

$ cat d11.rb

require ‘dl/import’

h = DL::Handle.new
addr = h.sym(‘strlen’)
cfunc = DL::CFunc.new(addr, DL::TYPE_INT)
func = DL::Function.new(cfunc, [DL::TYPE_VOIDP])
func.unbind

$ ruby-1.9 -v d11.rb
ruby 1.9.2dev (2009-05-16 trunk 23440) [i686-linux]
/usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/callback.rb:51:in []': no implicit conversion from nil to integer (TypeError) from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/callback.rb:51:inremove_callback_internal’
from
/usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/callback.rb:60:in
remove_cdecl_callback' from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/func.rb:88:inunbind’
from d11.rb:8:in `’


#2

e$B%A%1%C%He(B #1477 e$B$,99?7$5$l$^$7$?!#e(B (by Nobuyoshi N.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r23444.

http://redmine.ruby-lang.org/issues/show/1477