summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-26 16:02:30 +0200
committerKent Hansen <khansen@trolltech.com>2009-08-26 16:06:55 +0200
commit5be87d57602d72c225943f052783c1053cd3d81a (patch)
treecf62f85855d21924aa68c9b28b7dbe5fb4dc6bf6 /tests/auto/qscriptvalue/tst_qscriptvalue.cpp
parent478f18e37a04849f4577ded7ba60d8360b6c5c90 (diff)
don't crash when attempting to access properties of a JS Object that belonged to a deleted script engine
When the engine is deleted, the JSValue is invalidated, but the QScriptValue's type will still be QScriptValuePrivate::JSC. Use a new helper function, isObject(), that checks both that the value is of type JSC _and_ that it is valid, before calling JSValue::isObject() (JSValue::isObject() assumes that the value is valid).
Diffstat (limited to 'tests/auto/qscriptvalue/tst_qscriptvalue.cpp')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index e7120174f0..b125965fa5 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -3278,6 +3278,8 @@ void tst_QScriptValue::engineDeleted()
QVERIFY(v4.engine() == 0);
QVERIFY(v5.isValid());
QVERIFY(v5.engine() == 0);
+
+ QVERIFY(!v3.property("foo").isValid());
}
void tst_QScriptValue::valueOfWithClosure()