diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-05-08 11:38:14 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-05-09 21:28:06 +0200 |
commit | 406a9e1301e2597962ef0564348304be67d2c316 (patch) | |
tree | 40a2cfb1581dc7faf017e5e5598241298f2bd003 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
parent | 1b89c1edcae68351632c2755e5408410c2ff98e3 (diff) | |
download | qtdeclarative-406a9e1301e2597962ef0564348304be67d2c316.tar.gz |
QML: Encode "missing" line number as negated address of stack frame
This way we can identify which entry in a stack frame to amend when
processing an exception in generated code. However, negative line
numbers are also used to signal the position of "Ret" instructions.
Since you cannot throw an exception from a "Ret" instruction, those
cannot collide, but we cannot qAbs() the line number anymore when saving
it in the stack trace. We have to qAbs() it in all the places where it's
read.
Pick-to: 6.5
Fixes: QTBUG-112946
Change-Id: I24dc4008fb7eab38e4d24e70211c22e46f1b72a7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 20e6922dc4..f3869e6e40 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -74,6 +74,7 @@ private slots: void equalityVarAndNonStorable(); void equalsUndefined(); void evadingAmbiguity(); + void exceptionFromInner(); void excessiveParameters(); void extendedTypes(); void failures(); @@ -1415,6 +1416,21 @@ void tst_QmlCppCodegen::evadingAmbiguity() QCOMPARE(o2->property("i").toString(), QStringLiteral("Ambiguous2")); } +void tst_QmlCppCodegen::exceptionFromInner() +{ + QQmlEngine engine; + QQmlComponent component(&engine, QUrl(u"qrc:/qt/qml/TestTypes/exceptionFromInner.qml"_s)); + QVERIFY2(!component.isError(), component.errorString().toUtf8()); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + + QTest::ignoreMessage( + QtWarningMsg, + "qrc:/qt/qml/TestTypes/exceptionFromInner.qml:7: TypeError: " + "Cannot read property 'objectName' of null"); + QMetaObject::invokeMethod(object.data(), "disbelieveFail"); +} + void tst_QmlCppCodegen::excessiveParameters() { QQmlEngine engine; |