Ruby Bindings Animator problem

Richard Dale richard.j.dale at gmail.com
Tue Jan 6 14:23:27 CET 2009


On Tue, Jan 6, 2009 at 5:38 AM, 0xDeadC0de <roguestar191 at comcast.net> wrote:

> I was hopeing someone (Rdale maybe? ;) could help me with this one, when I
> try:
>
> class GloweyLabel < Plasma::Label
>        slots   'linkHovered()',
>        def initialize(par=nil)
>                super nil
>                Qt::Object.connect(self.nativeWidget,
> SIGNAL("linkHovered(QString)"), self, SLOT("linkHovered()") )
>        end
>        def linkHovered()
>                puts 'link hovered'
>                Plasma::Animator.self.animateElement(self,
> Plasma::Animator::ActivateAnimation)
>        end
> end
>
> It crashes quickly after a linkHovered event. hmm
>
> Trying to get any kind of animation on the label when a link is hovered in
> it
>
This is probably a garbage collection issue. Try adding 'GC.disable' to the
constructor for the applet and see if that makes a difference. When you
create a widget, always pass it a parent as the qtruby runtime uses trees of
QObjects/QWidgets to determine what instances can be allowed to be GC'd. If
an instance doesn't have a parent it will be GC'd if there are no
corresponding instances left in the Ruby world. You may need to change some
variables to be instance variables to avoid the instances being GC'd - ie
'foobar' becomes '@foobar' in your code.

If it is GC problem and adding parent widgets doesn't fix it, you can turn
on GC tracing like this:

Qt::Internal::setDebug Qt::QtDebugChannel::QTDB_GC

-- Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090106/36ddb162/attachment.htm 


More information about the Plasma-devel mailing list