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

Arno Rehn arno at arnorehn.de
Fri Jun 20 14:08:56 UTC 2008


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.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list