[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    Re: [Kde-bindings] qtruby crash
From:       "Richard Dale" <richard.j.dale () gmail ! com>
Date:       2007-03-16 13:11:10
Message-ID: 491684420703160611q3977d730oc8ccbf09247e949e () mail ! gmail ! com
[Download RAW message or body]

On Friday 16 March 2007, Caleb Tennis wrote:
> Found an interesting bug/crash in QtRuby (Qt4).  Check out this code:
>
> -------
>
> require 'Qt4'
>
> class TestClass < Qt::Widget
>   slots 'timeoutSlot()'
>
>   def initialize(parent)
>     super(parent)
>
>     t = Qt::Timer.new(self)
>     connect(t, SIGNAL('timeout()'), self, SLOT('timeoutSlot()'))
>     t.start(1000)
>   end
>
>   def timeoutSlot
>     puts "Got timeout"
>   end
>
> end
>
> class TestClass2 < TestClass
>
>   def initialize(parent)
>     super(parent)
>   end
>
>   def timeoutSlot
>     puts "Overriding the timeout"
>   end
> end
>
> app = Qt::Application.new(ARGV)
> tc = TestClass2.new(nil)
> tc.show
> app.exec
>
> ------
>
> Notice how TestClass2 overrides 'timeoutSlot', but never declares it as a
> slot.
>
> Adding a slot declaration to TestClass2 fixes the crash and the program
> runs like you would expect.
Yes, that is a known problem - slot/signal inheritance is borked. You can
always work round it by redeclaring the slot as you've found. But that was
the main thing I wanted to fix before the next release (as well as getting
qtruby to build with cmake). It needs to be like the equivalent code in the
Qyoto bindings and allocate the QMetaObjects properly for each subclass.

-- Richard
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic