diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-10-08 15:48:32 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-10-10 12:44:07 +0000 |
commit | d1ac941ce74af8aabfc2aa522e48ba826d3080f6 (patch) | |
tree | c6f781444d3acf44f07cc24f752f9f0fe792712a | |
parent | 213fdd341038d5256a017555570e3359cf111001 (diff) |
QML Tooling: Prevent property capture while collecting data
We don't want additional connections to be formed as result of reporting
data to the debugger.
Task-number: QTBUG-70989
Change-Id: I78b038a159addac43a8661e402a70e5b14fb222b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp | 28 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp | 2 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index 73e9a1b219..8c92b4b170 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -339,8 +339,36 @@ QV4::ReturnedValue QV4DataCollector::getValue(Ref ref) return array->get(ref, nullptr); } +class CapturePreventer +{ +public: + CapturePreventer(QV4::ExecutionEngine *engine) + { + if (QQmlEngine *e = engine->qmlEngine()) { + m_engine = QQmlEnginePrivate::get(e); + m_capture = m_engine->propertyCapture; + m_engine->propertyCapture = nullptr; + } + } + + ~CapturePreventer() + { + if (m_engine && m_capture) { + Q_ASSERT(!m_engine->propertyCapture); + m_engine->propertyCapture = m_capture; + } + } + +private: + QQmlEnginePrivate *m_engine = nullptr; + QQmlPropertyCapture *m_capture = nullptr; +}; + QJsonArray QV4DataCollector::collectProperties(const QV4::Object *object) { + CapturePreventer capturePreventer(engine()); + Q_UNUSED(capturePreventer); + QJsonArray res; QV4::Scope scope(engine()); diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index 2e2fda6746..941303d3ef 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -1638,7 +1638,7 @@ void tst_QQmlDebugJS::breakOnAnchor() QTRY_COMPARE(m_process->state(), QProcess::NotRunning); QCOMPARE(m_process->exitStatus(), QProcess::NormalExit); - QCOMPARE(breaks, 19); + QCOMPARE(breaks, 2); } QList<QQmlDebugClient *> tst_QQmlDebugJS::createClients() |