Product: Qt
Function: Other
Version: 4.5.2
Platform: Linux
Platform details: Linux demontip 2.6.30-gentoo-r2 #1 SMP PREEMPT Mon Jul 6 15:37:23 CEST 2009 i686 Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz GenuineIntel GNU/Linux
Compilers: GCC
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.3.3-r2/work/gcc-4.3.3/configure -prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.3.3 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.3.3/include/g+-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --disable-libgcj --with-arch=i686 --enable-languages=c,c+,objc,treelang --enable-shared --enable-threads=posix --enable__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.3.3-r2 p1.2, pie-10.1.5'
Thread model: posix
gcc version 4.3.3 (Gentoo 4.3.3-r2 p1.2, pie-10.1.5)
Steps to reproduce / test case:
1. Create a QScriptEngine
2. Add an object (SimpleObject) with a QVariant Q_PROPERTY (simpleObjectProperty) to the QScriptEngine
3. Set the value of this property via javascript
The javascript code is: while(1)
{ simpleObject.simpleObjectProperty = 1; }
The leak rises converting the QScriptValue to QVariant inseide the variantFromValue function. A QVariant with type 1 is created and in its destructor hadle>clear(&d); is not called.
You have the leak also with this simple program:
#include <QVariant>
int main(int argc, char *argv[])
{
while(1) {
QVariant v1( -1, (void*)0 );
}
}
In the attachment there is a siple code to reproduce the leak.