summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-26 10:01:38 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-26 10:03:34 (GMT)
commit56fbd7644b6f292dcd7d8d215bd469d94a0948ae (patch)
treeb0247803e12f05742f889269a82f9641fb16398a /tests
parentb914c388a809c17e4f76a4dcc1d3a1006e13c115 (diff)
downloadQt-56fbd7644b6f292dcd7d8d215bd469d94a0948ae.zip
Qt-56fbd7644b6f292dcd7d8d215bd469d94a0948ae.tar.gz
Qt-56fbd7644b6f292dcd7d8d215bd469d94a0948ae.tar.bz2
QVariant::setValue had a bug when changing its type
If it was shared and you then set it back to an int type, it is still marked as shared,. This might even lead to crashes. The patch was sent through gitorious by Jürgen Starek. Note: autotest added as well
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 0310276..63e47ab 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -255,6 +255,7 @@ private slots:
void convertByteArrayToBool() const;
void convertByteArrayToBool_data() const;
void toIntFromQString() const;
+ void task256984_setValue();
};
Q_DECLARE_METATYPE(QDate)
@@ -2967,5 +2968,21 @@ void tst_QVariant::toIntFromQString() const
QVERIFY(ok);
}
+void tst_QVariant::task256984_setValue()
+{
+ QTransform t; //we just take a value so that we're sure that it will be shared
+ QVariant v1 = t;
+ QVERIFY( v1.isDetached() );
+ QVariant v2 = v1;
+ QVERIFY( !v1.isDetached() );
+ QVERIFY( !v2.isDetached() );
+
+ qVariantSetValue(v2, 3); //set an integer value
+
+ QVERIFY( v1.isDetached() );
+ QVERIFY( v2.isDetached() );
+}
+
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"