[Qt-interest] Memory leak converting QScriptValue to QVariant
Alberto Scarpa
scarpa.alberto at gmail.com
Wed Aug 19 18:49:29 CEST 2009
Hi Thiago,
I know metatype ID of -1 is not a valid metatype ID for QVariant. Maybe i misunderstand the backtrace, but i have a leak
running the test program i attached. The test runs a QScriptEngine and never creates explicitly a QVariant. Did you
test my application? Can you tell me if it is a Qt bug or an incorrect behavior of my app.
Thanks
Alberto Scarpa
--------
Senior Software Engineer
M31 SpA
www.m31.com
On Wednesday 19 August 2009 18:17:17 Thiago Macieira wrote:
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: QVariant_Leak.tar.gz
Type: application/x-tgz
Size: 2008 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090819/0a858b98/attachment.bin
More information about the Qt-interest-old
mailing list