[Kde-bindings] Segfault (as promised)

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sun Oct 3 12:13:42 UTC 2004


On Sunday 03 October 2004 12:54, Han Holl wrote:
> On Sunday 03 October 2004 12:17, Richard Dale wrote:
> > Please find a fixed version of Qt.cpp attached. I think it needs trying
> > out to see if there are any unexpected side effects before commiting
> > though.
> >
> > -- Richard
>
> Well, that was fast. Works as expected now. Thanks.
>
> Ok here's the following: it's not as bad, because you get a warning before,
> but it's a segfault nevertheless:
>
> require 'Qt'
>
> class Segdemo < Qt::Widget
>   def initialize(*k)
>       super(*k)
>       lay = Qt::HBoxLayout.new(self)
>       ed = Qt::LineEdit.new('blah',self)
> # The next line should be: lay.addWidget(ed)
>       lay.addLayout(ed)
>   end
> end
>
> if $0 == __FILE__
>     a = Qt::Application.new(ARGV)
>     w = Segdemo.new
>     a.mainWidget = w
>     w.show
>     a.exec
> end
>
> QLayout::addChildLayout(), layout already has a parent
> client.rb:17: [BUG] Segmentation fault
> ruby 1.8.1 (2004-03-08) [i686-linux-gnu]
>
> Aborted
Thanks - another execellent crash! This one is caused by an optimization in 
the overloaded method resolution matching. If there is only one method found 
in the Smoke runtime, it assumes that it must be the right one and just takes 
that. If think it might be better to always do the matching on the arguments 
passed. Please find a version of qtruby.rb attached without the optmization.

-- Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtruby.rb
Type: application/x-ruby
Size: 19626 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20041003/8a4427da/attachment.bin>


More information about the Kde-bindings mailing list