summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-11-12 14:33:33 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-11-12 14:33:33 (GMT)
commit437e83e7707516129f68ee26aca5349845b7cc7b (patch)
tree0d4c8721f21acc5398e4eabff88a902cb23d0521 /tests/auto/qscriptvalue
parent7b3880475d02bd3db630387bccccc7e1ef9d4e9a (diff)
parente61071a2a170eaeb524778e9e903100323b88bbe (diff)
downloadQt-437e83e7707516129f68ee26aca5349845b7cc7b.zip
Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.gz
Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: configure doc/src/snippets/code/doc_src_qmake-manual.qdoc mkspecs/features/symbian/application_icon.prf mkspecs/features/symbian/default_post.prf mkspecs/features/symbian/symbian_building.prf qmake/generators/symbian/initprojectdeploy_symbian.cpp src/multimedia/audio/audio.pri src/network/access/qnetworkaccessmanager.cpp src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl_p.h src/plugins/bearer/corewlan/qcorewlanengine.mm src/plugins/phonon/mmf/mmf.pro tests/auto/qscriptvalue/tst_qscriptvalue.cpp tests/auto/qscriptvalue/tst_qscriptvalue.h tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp14
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 528b20e..de753d2 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2490,6 +2490,20 @@ void tst_QScriptValue::getSetData_nonObjects()
QVERIFY(!value.data().isValid());
}
+void tst_QScriptValue::setData_QTBUG15144()
+{
+ QScriptEngine eng;
+ QScriptValue obj = eng.newObject();
+ for (int i = 0; i < 10000; ++i) {
+ // Create an object with property 'fooN' on it, and immediately kill
+ // the reference to the object so it and the property name become garbage.
+ eng.evaluate(QString::fromLatin1("o = {}; o.foo%0 = 10; o = null;").arg(i));
+ // Setting the data will cause a JS string to be allocated, which could
+ // trigger a GC. This should not cause a crash.
+ obj.setData("foodfight");
+ }
+}
+
class TestScriptClass : public QScriptClass
{
public:
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h
index c6b2202..7bf0b66 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.h
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h
@@ -136,6 +136,7 @@ private slots:
void getSetData_objects();
void getSetData_nonObjects_data();
void getSetData_nonObjects();
+ void setData_QTBUG15144();
void getSetScriptClass_emptyClass_data();
void getSetScriptClass_emptyClass();
void getSetScriptClass_JSObjectFromCpp();
@@ -165,6 +166,7 @@ private slots:
void nestedObjectToVariant_data();
void nestedObjectToVariant();
+
private:
void newEngine()
{