From 406a9e1301e2597962ef0564348304be67d2c316 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 8 May 2023 11:38:14 +0200 Subject: 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 --- src/qml/jsapi/qjsengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/jsapi/qjsengine.cpp') diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index eda1c4c931..eca6562b90 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -530,7 +530,7 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in for (auto &&frame: trace) exceptionStackTrace->push_back(QString::fromLatin1("%1:%2:%3:%4").arg( frame.function, - QString::number(frame.line), + QString::number(qAbs(frame.line)), QString::number(frame.column), frame.source) ); -- cgit v1.2.3