qt5-qtdeclarative/0016-qv4qmlcontext-Fix-bounded-signal-expressions-when-de.patch
2021-06-01 09:49:33 -05:00

69 lines
3.4 KiB
Diff

From 37c290c5b8659256ff574a06a3df2c363ae446b5 Mon Sep 17 00:00:00 2001
From: Maximilian Goldstein <max.goldstein@qt.io>
Date: Wed, 2 Dec 2020 13:08:57 +0100
Subject: [PATCH 16/28] qv4qmlcontext: Fix bounded signal expressions when
debugging
Fixes: QTBUG-83599
Change-Id: I8909f0b2d3eca909512b99c172c8dc5e93e48482
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit bad85119bf35468292cfd80ecc934b66515f0c68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
src/qml/jsruntime/qv4qmlcontext.cpp | 4 ++--
.../qml/debugger/qv4debugger/tst_qv4debugger.cpp | 12 +++++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index e2d3b98ff6..6eece147a6 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -466,9 +466,9 @@ ReturnedValue QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(Lookup *
return static_cast<Heap::CallContext *>(ctx)->locals[index].asReturnedValue();
}
- // Skip only block contexts within the current call context.
+ // Skip only block and call contexts.
// Other contexts need a regular QML property lookup. See below.
- if (ctx->type != Heap::ExecutionContext::Type_BlockContext)
+ if (ctx->type != Heap::ExecutionContext::Type_BlockContext && ctx->type != Heap::ExecutionContext::Type_CallContext)
break;
}
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
index 84f5eebd10..e3cbeb9891 100644
--- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
+++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp
@@ -910,19 +910,25 @@ void tst_qv4debugger::signalParameters()
component.setData("import QtQml 2.12\n"
"QtObject {\n"
" id: root\n"
- " property string result\n"
+ " property string result: 'unset'\n"
+ " property string resultCallbackInternal: 'unset'\n"
+ " property string resultCallbackExternal: 'unset'\n"
" signal signalWithArg(string textArg)\n"
+ " function call(callback) { callback(); }\n"
+ " function externalCallback() { root.resultCallbackExternal = textArg; }\n"
" property Connections connections : Connections {\n"
" target: root\n"
- " onSignalWithArg: { root.result = textArg; }\n"
+ " onSignalWithArg: { root.result = textArg; call(function() { root.resultCallbackInternal = textArg; }); call(externalCallback); }\n"
" }\n"
" Component.onCompleted: signalWithArg('something')\n"
"}", QUrl("test.qml"));
- QVERIFY(component.isReady());
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
QScopedPointer<QObject> obj(component.create());
QVERIFY(obj);
QCOMPARE(obj->property("result").toString(), QLatin1String("something"));
+ QCOMPARE(obj->property("resultCallbackInternal").toString(), QLatin1String("something"));
+ QCOMPARE(obj->property("resultCallbackExternal").toString(), QLatin1String("unset"));
}
QTEST_MAIN(tst_qv4debugger)
--
2.31.1