[Kde-bindings] [Bug 100165] qtruby Qt::Socket::connectToHost fails on open call

Richard Dale Richard_Dale at tipitina.demon.co.uk
Fri Feb 25 08:36:22 UTC 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=100165         




------- Additional Comments From Richard_Dale tipitina demon co uk  2005-02-25 09:36 -------
On Thursday 24 February 2005 15:13, Caleb Tennis wrote:
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
> http://bugs.kde.org/show_bug.cgi?id=100165
>            Summary: qtruby Qt::Socket::connectToHost fails on open call
>            Product: bindings
>            Version: unspecified
>           Platform: unspecified
>         OS/Version: Linux
>             Status: NEW
>           Severity: normal
>           Priority: NOR
>          Component: general
>         AssignedTo: kde-bindings mail kde org
>         ReportedBy: caleb gentoo org
>
>
> Version:            (using KDE KDE 3.3.92)
> OS:                Linux
>
> It is a known problem:
> http://rubyforge.org/forum/forum.php?thread_id=1832&forum_id=723
>
> My workaround for this, which could probably be integrated into qtruby.rb
> somehow is to do this:
>
>
> module Kernel
>
>   def undef_open
>     alias_method :aliased_open, :open
>     undef_method :open
>   end
>
>   def def_open
>     alias_method :open, :aliased_open
>     undef_method :aliased_open
>   end
>
> end
>
> Then, anywhere where I do a connectToHost, I simply put an undef_open and
> def_open around it.
>
> It may be possible to directly override connectToHost and provide this
> functionality as well. _______________________________________________
Which version of QtRuby are you using? I fixed this when the problem when it 
was first reported. Here is the code from qtruby.rb:

module Kernel
	alias_method :_exec, :exec
	undef_method :exec
	
	# Kernel has a method called open() which takes a String as
	# the first argument. When a call is made to an open() method
	# in the Qt classes, it messes up the method_missing()
	# logic to divert it to the Smoke library. This code
	# fixes that problem by calling the appropriate method based
	# on the type of the first arg.
	alias_method :_open, :open
	
	def open(*k)
		if k.length > 0 and k[0].kind_of? String
			_open(*k)
		else
			method_missing(:open, *k)
		end
	end
end

So it looks at the args passed to Kernel.open() and calls the standard ruby 
version if the first arg is a String.

-- Richard



More information about the Kde-bindings mailing list