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

Phil Thompson phil at riverbankcomputing.com
Sun Aug 17 10:20:06 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},
>    ...
> };

If you change the table by hand, does it then work?

Phil



More information about the PyQt mailing list