[Kde-bindings] smoke generator: a bug in abstract methods

Petr Vanek petr at scribus.info
Fri Oct 16 08:02:39 UTC 2009


On Oct 14, 2009, at 4:45 PM, Petr Vanek wrote:

> hi all,
>
> can you confirm/reject my observations, please?
>
> We have some serious crashes in our bindings since we are using new
> smoke generator. After days of debugging of insane-unrelated-like code
> and traceback we discovered something strange:
>
> - look into smoke/qt build directory (where are x_*.cpp files located)
> - grep "callMethod(0," *cpp
> - lots of lines are found
>
> I think it's a bug, just because 0, the index to methods, in this case
> always points to QAbstractButton::metaObject() method - see static
> Smoke::Method methods array.
>
> Note: we discovered it in our example for x_QImage::paintEngine smoke
> implementation

ok, here are more observations:

it looks like there are missing some methods in the "write files"  
phase. It's strange, just because it looks like all methods are  
available from parser.
Unfotunately I don't know meanings of generator's source too much, so  
I think the maintainer can fix it easier ;)

Please look into debug patch:


it's not fix, but just some outputs for more clear issue description.

This patch also contains a fix for dangerous QHash::[] operator.
something = hash[key]; // it will create a key;value pair if it's not  
in the hash.
so secure way is:
if (hash.contains(key))
     something = hash.value(key);
else
     assert(0); // or warning or whatever...

cheers,
Petr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20091016/e6139ac0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generator.diff
Type: application/octet-stream
Size: 5258 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20091016/e6139ac0/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20091016/e6139ac0/attachment-0001.html>


More information about the Kde-bindings mailing list