[PyQt] Bug in SIP w.r.t. signals, typedefs and mapped types

Phil Thompson phil at riverbankcomputing.com
Sun Aug 17 11:56:59 BST 2008


On Sun, 17 Aug 2008 01:44:29 +0200, Simon Edwards <simon at simonzone.com>
wrote:
> Hello Phil,
> 
> While working on integrating Python into KDE4's Plasma I hit a crasher 
> when using @pyqtSignature where one of the arguments for the slot is a 
> typedef which in turn in a mapped type:
> 
> @pyqtSignature("dataUpdated(const QString &, const 
> Plasma::DataEngine::Data &)")
> 
> Plasma::DataEngine::Data is a typedef for QHash<QString,QVariant>.
> 
> This would crash when the signal is sent to the slot. After a heap of 
> debugging I've figured out goes wrong. When the signal comes in the 
> Plasma::DataEngine::Data type was being converted to QHash. Later when 
> sip looks for the mapped type in order to do the conversion, it can't 
> find what it is looking for but sip continues and dereferences a null 
> pointer.
> 
> The cause is in the code generated for the plasma module. The 
> typedefsTable looks something like this:
> 
> static sipTypedefDef typedefsTable[] = {
>    ...
>    {"Plasma::DataEngine::Data", mtype_sat, "QHash", NULL},
>    ...
> };
> 
> The extra types for the QHash are stripped off. The table should look 
> more like:
> 
> static sipTypedefDef typedefsTable[] = {
>    ...
>    {"Plasma::DataEngine::Data", mtype_sat, "QHash<QString,QVariant>",
> NULL},
>    ...
> };

Should be fixed in tonight's snapshot.

I'm not planning another SIP release for some time. However, if you need
the fix for an upcoming KDE release then let me know.

Phil

Thanks,
Phil



More information about the PyQt mailing list