From 2ce01aa8ca69b882e4186625667d191f3428fc3a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 Apr 2018 14:42:43 +0200 Subject: Clean up manual reference counting of QQmlScriptBlob Replace manual reference counting for loaded scripts with QQmlRefPointer use. Change-Id: I5d765a3bb73a04b3a894a04e066d4d73220dafe5 Reviewed-by: Lars Knoll --- src/qml/qml/qqmltypeloader_p.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/qml/qml/qqmltypeloader_p.h') diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index 0494034b3e..1d78364548 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -284,7 +284,7 @@ public: private: virtual bool qmldirDataAvailable(QQmlQmldirData *, QList *); - virtual void scriptImported(QQmlScriptBlob *, const QV4::CompiledData::Location &, const QString &, const QString &) {} + virtual void scriptImported(const QQmlRefPointer &, const QV4::CompiledData::Location &, const QString &, const QString &) {} void dependencyError(QQmlDataBlob *) override; void dependencyComplete(QQmlDataBlob *) override; @@ -308,7 +308,7 @@ public: QQmlRefPointer getType(const QUrl &url, Mode mode = PreferSynchronous); QQmlRefPointer getType(const QByteArray &, const QUrl &url, Mode mode = PreferSynchronous); - QQmlScriptBlob *getScript(const QUrl &); + QQmlRefPointer getScript(const QUrl &); QQmlQmldirData *getQmldir(const QUrl &); QString absoluteFilePath(const QString &path); @@ -436,11 +436,9 @@ public: struct ScriptReference { - ScriptReference() : script(nullptr) {} - QV4::CompiledData::Location location; QString qualifier; - QQmlScriptBlob *script; + QQmlRefPointer script; }; private: @@ -493,7 +491,7 @@ private: bool reportErrors = true, QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType); - void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override; + void scriptImported(const QQmlRefPointer &blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override; SourceCodeData m_backupSourceCode; // used when cache verification fails. @@ -539,7 +537,7 @@ public: QUrl url; QString urlString; QQmlTypeNameCache *typeNameCache; - QList scripts; + QVector> scripts; QV4::ReturnedValue scriptValueForContext(QQmlContextData *parentCtxt); @@ -569,12 +567,10 @@ public: struct ScriptReference { - ScriptReference() : script(nullptr) {} - QV4::CompiledData::Location location; QString qualifier; QString nameSpace; - QQmlScriptBlob *script; + QQmlRefPointer script; }; QQmlScriptData *scriptData() const; @@ -587,7 +583,7 @@ protected: QString stringAt(int index) const override; private: - void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override; + void scriptImported(const QQmlRefPointer &blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override; void initializeFromCompilationUnit(const QQmlRefPointer &unit); QList m_scripts; -- cgit v1.2.3