Blame SOURCES/0016-qv4qmlcontext-Fix-bounded-signal-expressions-when-de.patch

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