diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-13 13:31:35 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-13 12:41:33 +0000 |
commit | 0e3380f9c6ab6e3ea7398caccf5aa84f1575f1cd (patch) | |
tree | fcd63e5b7e60fc3150ad4b1d5a6031a9c6b3b4a8 /tests | |
parent | 6e568c6ef5b34e32b0e2ec7b66d01d63888166a5 (diff) |
Fix crash when C++ QJSValue parameterized signal interacts with JS
When converting the parameters of a C++ signal to JS values to provide
to a signal handler written in JS, the conversion of a QJSValue to a
QV4::Value* may yield a null pointer in case of a default constructed
QJSValue for example. This is a regression from commit
aa869cbb06bcf005e238059a2cb0205947ff0b5f and we must check for this.
Task-number: QTBUG-58133
Change-Id: I528b606b2851dfb3072e54902bd8843d31571a55
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml index 4fc2dab943..676593096c 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalParameterTypes.qml @@ -15,4 +15,6 @@ MyQmlObject onMySignal: { intProperty = a; realProperty = b; colorProperty = c; variantProperty = d; enumProperty = e; qtEnumProperty = f; } onBasicSignal: root.mySignal(10, 19.2, Qt.rgba(1, 1, 0, 1), Qt.rgba(1, 0, 1, 1), MyQmlObject.EnumValue3, Qt.LeftButton) + + onQjsValueEmittingSignal: {} } diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 47fb2a56e7..1f7f3344ef 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -244,6 +244,7 @@ signals: void signalWithGlobalName(int parseInt); void intChanged(); void qjsvalueChanged(); + void qjsValueEmittingSignal(QJSValue value); public slots: void deleteMe() { delete this; } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 88a8886ecb..b8f12e772d 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -1410,6 +1410,7 @@ void tst_qqmlecmascript::signalParameterTypes() QVERIFY(object != 0); emit object->basicSignal(); + emit object->qjsValueEmittingSignal(QJSValue()); QCOMPARE(object->property("intProperty").toInt(), 10); QCOMPARE(object->property("realProperty").toReal(), 19.2); |