diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-11 16:10:47 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-12 10:09:42 +0100 |
commit | 8dbe5b2be4e65e96013651f1ffee1cc26dd1ead1 (patch) | |
tree | 64a2f54910f99aedb0aac93d042e9a21056cabc0 /src/qml | |
parent | 24372250debc0a067470392776a178b155cedf3e (diff) |
Remove QQmlCleanup from QQmlScriptData
It prevents the compilation unit held by QQmlScriptData from being
released on clearComponentCache(). The comment justifying the
QQmlCleanup has been wrong since we moved away from V8.
Task-number: QTBUG-89659
Pick-to: 5.15
Change-Id: I220561d90f707540e47c76d60a51468ee231ce9a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmlscriptdata.cpp | 14 | ||||
-rw-r--r-- | src/qml/qml/qqmlscriptdata_p.h | 13 |
2 files changed, 1 insertions, 26 deletions
diff --git a/src/qml/qml/qqmlscriptdata.cpp b/src/qml/qml/qqmlscriptdata.cpp index 50ec0e20cd..684564fcfb 100644 --- a/src/qml/qml/qqmlscriptdata.cpp +++ b/src/qml/qml/qqmlscriptdata.cpp @@ -117,11 +117,6 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext( QV4::ExecutionEngine *v4 = parentQmlContextData->engine()->handle(); QV4::Scope scope(v4); - if (!hasEngine()) { - addToEngine(parentQmlContextData->engine()); - addref(); - } - QV4::Scoped<QV4::QmlContext> qmlExecutionContext(scope); if (auto qmlContextData = qmlContextDataForContext(parentQmlContextData)) { qmlExecutionContext = QV4::QmlContext::create(v4->rootContext(), std::move(qmlContextData), @@ -158,13 +153,4 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext( return value->asReturnedValue(); } -void QQmlScriptData::clear() -{ - typeNameCache = nullptr; - scripts.clear(); - - // An addref() was made when the QQmlCleanup was added to the engine. - release(); -} - QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlscriptdata_p.h b/src/qml/qml/qqmlscriptdata_p.h index abbafc33c2..38b80e1bfa 100644 --- a/src/qml/qml/qqmlscriptdata_p.h +++ b/src/qml/qml/qqmlscriptdata_p.h @@ -65,14 +65,7 @@ QT_BEGIN_NAMESPACE class QQmlTypeNameCache; class QQmlContextData; -// QQmlScriptData instances are created, uninitialized, by the loader in the -// load thread. The first time they are used by the VME, they are initialized which -// creates their v8 objects and they are referenced and added to the engine's cleanup -// list. During QQmlCleanup::clear() all v8 resources are destroyed, and the -// reference that was created is released but final deletion only occurs once all the -// references as released. This is all intended to ensure that the v8 resources are -// only created and destroyed in the main thread :) -class Q_AUTOTEST_EXPORT QQmlScriptData : public QQmlCleanup, public QQmlRefCount +class Q_AUTOTEST_EXPORT QQmlScriptData : public QQmlRefCount { private: friend class QQmlTypeLoader; @@ -89,13 +82,9 @@ public: QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit() const { return m_precompiledScript; } -protected: - void clear() override; // From QQmlCleanup - private: friend class QQmlScriptBlob; - void initialize(QQmlEngine *); QQmlRefPointer<QQmlContextData> qmlContextDataForContext( const QQmlRefPointer<QQmlContextData> &parentQmlContextData); |