[PyKDE] Core dump and QString

Phil Thompson phil at river-bank.demon.co.uk
Tue Apr 18 02:19:12 BST 2000


Pete Ware wrote:
> 
> Qt 2.0.2, PyQt 0.11.1.  Calling QMessageBox.warning() with None as one
> of the string arguments crashes (core dump).  It does so because
> "QString *a5" is NULL since the parameter is None and the code says:
> 
>     res = QMessageBox::warning( a0,* a1,* a2,* a3,* a4,* a5, a6, a7);
> 
> Note the "*a5".  Shouldn't None == QString::null?

No.  None is mapped to NULL, it is not mapped to "the default value".

> Also, why throughout the code does it say:
> 
>         int istemp4 = sipConvertTo_QString(a4obj,(QString **)&a4,&iserr);
> #if defined(SIP_VERS_QT_1x)
>         int istemp4 = sipConvertTo_QString(a4obj,(QString **)&a4,&iserr);
> #endif
> 
> It seems like for QT_1x it is going to do the same thing twice.
> First, shouldn't it be:
> 
> #if defined(SIP_VERS_QT_1x)
>         int istemp4 = sipConvertTo_QString(a4obj,(QString **)&a4,&iserr);
> #else
>         int istemp4 = sipConvertTo_QString(a4obj,(QString **)&a4,&iserr);
> #endif
> 
> Ignoring that they are the same line?  Or is something clever going on
> (like getting reference counting set right).

It's a partial (ie. incomplete) optimisation.  You'll see that the whole
section of code is itself between...

#if defined(SIP_VERS_QT_2x)
...
#endif

...so the...

#if defined(SIP_VERS_QT_1x)
...
#endif

...can never be true.  I just haven't got round to taking the
optimisation to the extent that those (impossible) lines are never
generated.

I still need to fix the versioning in order to support Qt 2.1.0 (and
KDE2).  I know (after about 6 months of getting it wrong) what needs to
be done - just need to find the time to do it.

Phil




More information about the PyQt mailing list