Hi,
i have Qt 4.7.1 and VS2010 Express
the following code crashes with no reason:
#include "QApplication"
#include <QtCore>
void test( )
{
QList<QVariant> list;
v.setValue(1); // init variant with integer = 1
list.append(v); // add variant to list
v2.setValue(list); // add list to variant
qDebug() << v;
qDebug() << list;
qDebug() << v2;
// leaving this function will crash with a corrupted heap
// output see below
}
int main( int argc , char *argv[] )
{
test();
return app.exec();
}
#include "QApplication"
#include <QtCore>
void test( )
{
QVariant v, v2;
QList<QVariant> list;
v.setValue(1); // init variant with integer = 1
list.append(v); // add variant to list
v2.setValue(list); // add list to variant
qDebug() << v;
qDebug() << list;
qDebug() << v2;
// leaving this function will crash with a corrupted heap
// output see below
}
int main( int argc , char *argv[] )
{
test();
QApplication app(argc, argv);
return app.exec();
}
To copy to clipboard, switch view to plain text mode
my output:
QVariant(int, 1)
(QVariant(int, 1) )
QVariant(QVariantList, (QVariant(int, 1) ) )
To copy to clipboard, switch view to plain text mode
after the crash it points me to "qguivariant.cpp" line 280:
qcoreVariantHandler()->clear(d);
qcoreVariantHandler()->clear(d);
To copy to clipboard, switch view to plain text mode
any help ?
thanks
Bookmarks