[Qt-interest] Memory leak converting QScriptValue to QVariant
Thiago Macieira
thiago.macieira at trolltech.com
Wed Aug 19 18:17:17 CEST 2009
Em Quarta-feira 19 Agosto 2009, às 11:34:23, Alberto Scarpa escreveu:
> The leak rises converting the QScriptValue to QVariant inseide the variantF
> romValue function.
> A QVariant with type -1 is created and in its destructor hadle->clear(&d);
> is not called (see the following backtrace).
>
> You have the leak with this simple program too:
>
> #include <QVariant>
> int main(int argc, char *argv[])
> {
> while(1)
> QVariant v1( -1, (void*)0 );
> }
>
A meta type ID of -1 should never be used. That's undefined behaviour, so a
leak can be expected.
The bug is actually in the code that is getting the metatype ID and not
checking for -1.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Development Frameworks
Sandakerveien 116, NO-0402 Oslo, Norway
Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4
http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090819/cca7ff50/attachment.bin
More information about the Qt-interest-old
mailing list