[Kde-bindings] Crash in qtruby4 (svn) using custom C++ classes

Stefano Crocco stefano.crocco at alice.it
Sat Jun 21 20:17:27 UTC 2008


On Friday 20 June 2008, Arno Rehn wrote:
> Am Freitag 20 Juni 2008 15:48:33 schrieb Richard Dale:
> > On Friday 20 June 2008 14:45:18 Stefano Crocco wrote:
> > > On Friday 20 June 2008, Arno Rehn wrote:
> > > > I get the same error, same gcc and ld version, ruby 1.8.6_p114 and Qt
> > > > 4.4.0. You can set Qt.debug_level = Qt::DebugLevel::Extensive just
> > > > before the call to the function that returns a string to get more
> > > > information. I'll take a look into this, thanks for the report.
> > >
> > > I did what you suggested. This is the result:
> > > doing string_test        
> > > classname    == QWidget  
> > >
> > > :: method == stringTest  
> > >
> > > -> methodIds == []        
> > > candidate list:          
> > > Possible prototypes:      
> > >         QRegion QWidget::mask() const
> >
> > Actually we are invoking a native slot that isn't in the smoke library
> > and so we're not going to get anything useful from the log of things
> > looked up in the smoke lib. It will always be missing, and then the
> > QtRuby runtime will look for a native slot that matches the method name
> > being called and invoke that if one is found.
>
> I already tracked the bug down to
>
> 	smokeStackToQtStack(_stack, o + 1, 1, _items, _args);
> 	void * ptr;
> 	o[0] = &ptr;
> 	_obj->qt_metacall(QMetaObject::InvokeMetaMethod, _id, o);
>
> qt_metacall invokes the method correctly, but then the storing of the
> return value fails. In the moc file it says:
>
> 	if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; }  break;
>
> but _a[0] respectively o[0] does not point to allocated memory, it's just
> an uninitialized pointer. So I guess here is the problem.

With the last changes to QtRuby, I get a crash when calling the first slot
(int_test). The backtrace is this:

#0  0xb7f38410 in __kernel_vsyscall ()
#1  0xb7cc0690 in raise () from /lib/libc.so.6
#2  0xb7cc1ed8 in abort () from /lib/libc.so.6
#3  0xb7d013f3 in malloc_printerr () from /lib/libc.so.6
#4  0xb7d02ccb in free () from /lib/libc.so.6
#5  0xb6a9461d in operator delete () from /usr/lib/gcc/i686-pc-linux-
gnu/4.3.1/libstdc++.so.6
#6  0xb6a94667 in operator delete[] () from /usr/lib/gcc/i686-pc-linux-
gnu/4.3.1/libstdc++.so.6
#7  0xb7531031 in ~SigSlotBase (this=0x2) at 
/home/stefano/Desktop/kdebindings/ruby/qtruby/src/marshall_types.cpp:604
#8  0xb74fd868 in ~InvokeNativeSlot (this=0xbfc02574) at 
/home/stefano/Desktop/kdebindings/ruby/qtruby/src/marshall_types.h:204
#9  0xb74fcf34 in method_missing (argc=1, argv=0xbfc02940, self=3059912000) at 
/home/stefano/Desktop/kdebindings/ruby/qtruby/src/Qt.cpp:865
#10 0xb7e93805 in call_cfunc () from /usr/lib/libruby18.so.1.8
#11 0xb7e9d945 in rb_call0 () from /usr/lib/libruby18.so.1.8
#12 0xb7e9dad1 in rb_call () from /usr/lib/libruby18.so.1.8
#13 0xb7e9e3ad in rb_funcall2 () from /usr/lib/libruby18.so.1.8
#14 0xb7ea3b36 in method_missing () from /usr/lib/libruby18.so.1.8
#15 0xb7e9dbc3 in rb_call () from /usr/lib/libruby18.so.1.8
#16 0xb7e98599 in rb_eval () from /usr/lib/libruby18.so.1.8
#17 0xb7e99e30 in rb_eval () from /usr/lib/libruby18.so.1.8
#18 0xb7e99fb3 in rb_eval () from /usr/lib/libruby18.so.1.8
#19 0xb7e9acc5 in rb_eval () from /usr/lib/libruby18.so.1.8
#20 0xb7ea8fe3 in ruby_exec_internal () from /usr/lib/libruby18.so.1.8
#21 0xb7ea9023 in ruby_exec () from /usr/lib/libruby18.so.1.8
#22 0xb7ea9058 in ruby_run () from /usr/lib/libruby18.so.1.8
#23 0x08048715 in main ()

Stefano




More information about the Kde-bindings mailing list