[Kde-bindings] QtRuby + Ruby 1.9 and the kross/qtruby crash

Cyrille Berger cberger at cberger.net
Mon Feb 25 11:49:34 UTC 2008


On Monday 25 February 2008, Sebastian Sauer wrote:
> Cyrille Berger wrote:
> > On Monday 25 February 2008, Sebastian Sauer wrote:
> >> > So I decided to try ruby 1.9 (to get it build and running I had to
> >> > patch QtRuby source and use the FindRUBY.cmake in attachement ). As
> >> > far as I can see with Ruby 1.9 I don't get a crash with QtRuby and
> >> > Kross on 32bits system. But unfortunately the connect function is also
> >> > broken :(
> >>
> >> The connect() of QtRuby or of Kross?
> >
> > QtRuby, for Kross I might have been able to find a fix ;)
> >
> >> Also just ~2 days ago I found an issue within our handling of
> >> VALUE RubyExtension::toVALUE(RubyExtension* extension)
> >> and fixed it. There we always registered a deleter what may result in
> >> double free's :-/ So, it could even possible that the problem is/was
> >> also related to that issue though it's fixed now :)
> >
> > Nah no luck. And anyway double free would be catched by valgrind. (and
> > would affect amd64 as well).
>
> okeli, as usual I failed to catch some sleeps since yesterday and used the
> time to debug a bit and seems I run into another crasher with 1.8.6 that
> may related.
>
> The case;
> 1. RubyExtension::callMetaMethod is called with funcname=callFunction with
> 2 arguments. 1st is the functionname, 2th is a QVariantList that has one
> item, the QObject*
> 2. Within RubyExtension::callMetaMethod we create the RubyCallCache for
> @callcachecallFunction
> 3. RubyCallCache::execfunction is called. Everything is still fine.
> 4. Within RubyCallCache::execfunction() we call d->object->qt_metacall()
> 5. Now the RubyScript::callFunction() got executed. Everything is still
> fine and a correct pointer to a QObject* got returned.
> 6. Execution continues at RubyCallCache::execfunction() and now we have an
> invalid pointer to the by d->object->qt_metacall() returned QObject* (the
> variantargs[0]->toVoidStar()).
>
> So, questions is, if this is a problem with the combination/implementation
> of our callcache and/or if something wents totaly wrong in ruby (according
> to gdb, between 5. and 6. Ruby does quit a lot of things and as usual it's
> not easy to follow that route).

One thing I did forgot to remind. Here is my test script :

require 'Qt4'
class MyWidget < Qt::Widget
  slots 'smthg()'
  signals 'hello()'
  def initialize()
    super()
    @mO = Qt::Internal.getMetaObject(self.class, self)
  end
  def smthg()
  end
end

$wd = MyWidget.new
$wd.show

So basically. So there is no call to Kross functions from that script. The 
crash is triggered by something we do (or do not do correctly) when calling 
scripts.

I am also rather skeptical if we should invest time on this, a "stable" 
version of ruby 1.9 is supposed to be released some time in the near future, 
I have no problem to say, if you want to use QtRuby + Kross, then you have to 
use ruby > 1.9.1.

-- 
Cyrille Berger



More information about the Kde-bindings mailing list